Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Plasma
Plasma Desktop
Commits
ee49020b
Commit
ee49020b
authored
Mar 30, 2021
by
David Redondo
🏎
Browse files
Use DBus interface to highlight windows
The KWin effect has gained a dbus interface to also support wayland.
BUG:433134
parent
f2c4f4e5
Changes
2
Hide whitespace changes
Inline
Side-by-side
applets/taskmanager/plugin/backend.cpp
View file @
ee49020b
...
...
@@ -35,6 +35,10 @@
#include <QAction>
#include <QActionGroup>
#include <QApplication>
#include <QDBusConnection>
#include <QDBusMessage>
#include <QDBusMetaType>
#include <QDBusPendingCall>
#include <QJsonArray>
#include <QMenu>
#include <QQuickItem>
...
...
@@ -56,9 +60,12 @@ namespace KAStats = KActivities::Stats;
using
namespace
KAStats
;
using
namespace
KAStats
::
Terms
;
static
const
QString
highlightWindowName
=
QStringLiteral
(
"org.kde.KWin.HighlightWindow"
);
static
const
QString
highlightWindowPath
=
QStringLiteral
(
"/org/kde/KWin/HighlightWindow"
);
static
const
QString
&
highlightWindowInterface
=
highlightWindowName
;
Backend
::
Backend
(
QObject
*
parent
)
:
QObject
(
parent
)
,
m_panelWinId
(
0
)
,
m_highlightWindows
(
false
)
,
m_actionGroup
(
new
QActionGroup
(
this
))
{
...
...
@@ -585,16 +592,7 @@ void Backend::windowsHovered(const QVariant &_winIds, bool hovered)
m_windowsToHighlight
.
clear
();
if
(
hovered
)
{
const
QVariantList
&
winIds
=
_winIds
.
toList
();
foreach
(
const
QVariant
&
_winId
,
winIds
)
{
bool
ok
=
false
;
qlonglong
winId
=
_winId
.
toLongLong
(
&
ok
);
if
(
ok
)
{
m_windowsToHighlight
.
append
(
winId
);
}
}
m_windowsToHighlight
=
_winIds
.
value
<
QStringList
>
();
}
updateWindowHighlight
();
...
...
@@ -602,31 +600,7 @@ void Backend::windowsHovered(const QVariant &_winIds, bool hovered)
void
Backend
::
updateWindowHighlight
()
{
if
(
!
m_highlightWindows
)
{
if
(
m_panelWinId
)
{
KWindowEffects
::
highlightWindows
(
m_panelWinId
,
QList
<
WId
>
());
m_panelWinId
=
0
;
}
return
;
}
if
(
m_taskManagerItem
&&
m_taskManagerItem
->
window
())
{
m_panelWinId
=
m_taskManagerItem
->
window
()
->
winId
();
}
else
{
return
;
}
QList
<
WId
>
windows
=
m_windowsToHighlight
;
if
(
!
windows
.
isEmpty
()
&&
m_toolTipItem
&&
m_toolTipItem
->
window
())
{
windows
.
append
(
m_toolTipItem
->
window
()
->
winId
());
}
if
(
!
windows
.
isEmpty
()
&&
m_groupDialog
)
{
windows
.
append
(
m_groupDialog
->
winId
());
}
KWindowEffects
::
highlightWindows
(
m_panelWinId
,
windows
);
auto
message
=
QDBusMessage
::
createMethodCall
(
highlightWindowName
,
highlightWindowPath
,
highlightWindowInterface
,
QStringLiteral
(
"highlightWindows"
));
message
<<
(
m_highlightWindows
?
m_windowsToHighlight
:
QStringList
());
QDBusConnection
::
sessionBus
().
asyncCall
(
message
);
}
applets/taskmanager/plugin/backend.h
View file @
ee49020b
...
...
@@ -119,9 +119,8 @@ private:
QQuickItem
*
m_taskManagerItem
=
nullptr
;
QQuickItem
*
m_toolTipItem
=
nullptr
;
QQuickWindow
*
m_groupDialog
=
nullptr
;
WId
m_panelWinId
;
bool
m_highlightWindows
;
Q
List
<
WId
>
m_windowsToHighlight
;
Q
StringList
m_windowsToHighlight
;
QActionGroup
*
m_actionGroup
=
nullptr
;
KActivities
::
Consumer
*
m_activitiesConsumer
=
nullptr
;
};
...
...
Write
Preview
Supports
Markdown
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