Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
P
Plasma Integration
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
3
Merge Requests
3
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Plasma
Plasma Integration
Commits
778ee5f5
Commit
778ee5f5
authored
Jan 04, 2018
by
David Edmundson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update AppMenu for an app having multiple windows
parent
189a19f4
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
19 additions
and
10 deletions
+19
-10
src/platformtheme/kdeplatformtheme.cpp
src/platformtheme/kdeplatformtheme.cpp
+2
-2
src/platformtheme/kwaylandintegration.cpp
src/platformtheme/kwaylandintegration.cpp
+10
-5
src/platformtheme/kwaylandintegration.h
src/platformtheme/kwaylandintegration.h
+7
-3
No files found.
src/platformtheme/kdeplatformtheme.cpp
View file @
778ee5f5
...
...
@@ -361,11 +361,11 @@ QPlatformMenuBar *KdePlatformTheme::createPlatformMenuBar() const
if
(
m_kwaylandIntegration
)
{
if
(
oldWindow
)
{
m_kwaylandIntegration
->
setAppMenu
(
QString
(),
QString
());
m_kwaylandIntegration
->
setAppMenu
(
oldWindow
,
QString
(),
QString
());
}
if
(
newWindow
)
{
m_kwaylandIntegration
->
setAppMenu
(
serviceName
,
objectPath
);
m_kwaylandIntegration
->
setAppMenu
(
newWindow
,
serviceName
,
objectPath
);
}
}
});
...
...
src/platformtheme/kwaylandintegration.cpp
View file @
778ee5f5
...
...
@@ -140,7 +140,7 @@ void KWaylandIntegration::shellSurfaceCreated(QWindow *w)
if
(
m_appMenuManager
)
{
auto
menu
=
m_appMenuManager
->
create
(
s
,
w
);
w
->
setProperty
(
"org.kde.plasma.integration.appmenu"
,
QVariant
::
fromValue
(
menu
));
menu
->
setAddress
(
m_
appMenuServiceName
,
m_
appMenuObjectPath
);
menu
->
setAddress
(
m_
windowInfo
[
w
].
appMenuServiceName
,
m_windowInfo
[
w
].
appMenuObjectPath
);
}
}
...
...
@@ -171,11 +171,16 @@ void KWaylandIntegration::setWindowProperty(QWindow *window, const QByteArray &n
}
}
void
KWaylandIntegration
::
setAppMenu
(
const
QString
&
serviceName
,
const
QString
&
objectPath
)
void
KWaylandIntegration
::
setAppMenu
(
QWindow
*
window
,
const
QString
&
serviceName
,
const
QString
&
objectPath
)
{
m_appMenuServiceName
=
serviceName
;
m_appMenuObjectPath
=
objectPath
;
auto
menu
=
property
(
"org.kde.plasma.integration.appmenu"
).
value
<
AppMenu
*>
();
if
(
!
m_windowInfo
.
contains
(
window
))
{
//effectively makes this connect unique
connect
(
window
,
&
QObject
::
destroyed
,
this
,
[
=
]()
{
m_windowInfo
.
remove
(
window
);
});
}
m_windowInfo
[
window
].
appMenuServiceName
=
serviceName
;
m_windowInfo
[
window
].
appMenuObjectPath
=
objectPath
;
auto
menu
=
window
->
property
(
"org.kde.plasma.integration.appmenu"
).
value
<
AppMenu
*>
();
if
(
menu
)
{
menu
->
setAddress
(
serviceName
,
objectPath
);
}
...
...
src/platformtheme/kwaylandintegration.h
View file @
778ee5f5
...
...
@@ -21,6 +21,7 @@
#define KWAYLANDINTEGRATION_H
#include <QObject>
#include <QHash>
class
QWindow
;
...
...
@@ -42,7 +43,7 @@ public:
void
init
();
void
setWindowProperty
(
QWindow
*
window
,
const
QByteArray
&
name
,
const
QByteArray
&
value
);
void
setAppMenu
(
const
QString
&
serviceName
,
const
QString
&
objectPath
);
void
setAppMenu
(
QWindow
*
window
,
const
QString
&
serviceName
,
const
QString
&
objectPath
);
bool
eventFilter
(
QObject
*
watched
,
QEvent
*
event
)
override
;
...
...
@@ -54,8 +55,11 @@ private:
KWayland
::
Client
::
ServerSideDecorationManager
*
m_decoration
=
nullptr
;
KWayland
::
Client
::
AppMenuManager
*
m_appMenuManager
=
nullptr
;
QString
m_appMenuServiceName
;
QString
m_appMenuObjectPath
;
struct
WindowInfo
{
QString
appMenuServiceName
;
QString
appMenuObjectPath
;
};
QHash
<
QWindow
*
,
WindowInfo
>
m_windowInfo
;
};
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment