Add a method to dbus interface to query information about a window
ClosedPublic

Authored by graesslin on Feb 13 2018, 7:28 PM.

Details

Summary

This call is added for the window rules kcm which has a detect
functionality. As that detect functionality cannot query any Wayland
windows we need to have some functionality in KWin core. Furthermore
this allows to simplify the code in the kcm as all the custom X11
interaction can be removed. KWin internally has the functionality to
find a window at a given position.

From a security perspective adding this dbus method is fine as the user
stays in control of the functionality. It requires active click to
select a window.

The new dbus call is already used in the rules kcm replacing the
X11 based detect functionality. That a detect is now able to get
information for both X11 and Wayland windows. So far only X11 windows
on X11 were supported. So this fills an important gap in the Wayland
offerings. It should now be possible to create rules for Wayland
windows (though may not be fully functional).

Test Plan

Run the kwin_rules_dialog and it detected the window correctly

Diff Detail

Repository
R108 KWin
Lint
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.
graesslin created this revision.Feb 13 2018, 7:28 PM
Restricted Application added a project: KWin. · View Herald TranscriptFeb 13 2018, 7:29 PM
Restricted Application added subscribers: kwin, plasma-devel. · View Herald Transcript
graesslin requested review of this revision.Feb 13 2018, 7:29 PM
Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptFeb 13 2018, 7:29 PM
broulik added inline comments.
dbusinterface.cpp
199

Can you use introspection to fill this QVariantMap rather than manually doing this?

Restricted Application edited projects, added KWin; removed Plasma. · View Herald TranscriptFeb 13 2018, 7:58 PM

Cool approach. One minor thing that won't happen anyway.

dbusinterface.cpp
193

can you add:

if (m_replyQuery...) {sendError()}

otherwise if a user makes two calls without selecting a window inbetween the first call will just never get a response

kcmkwin/kwinrules/detectwidget.cpp
152

I would explicilty specify a massive timeout for anything which has user interaction the other side.

kcmkwin/kwinrules/ruleswidget.cpp
790

This isn't a guess anymore?

Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptFeb 13 2018, 8:03 PM
graesslin added inline comments.Feb 14 2018, 5:30 AM
dbusinterface.cpp
199

We don't have properties for all of them and it's currently hand picked for what the kcm needs.

Restricted Application edited projects, added KWin; removed Plasma. · View Herald TranscriptFeb 14 2018, 5:30 AM
graesslin updated this revision to Diff 27318.Feb 16 2018, 5:53 AM

Remove unneeded comment

Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptFeb 16 2018, 5:53 AM
graesslin marked an inline comment as done.Feb 16 2018, 5:54 AM
graesslin added inline comments.
dbusinterface.cpp
193

That's already the case. If we get into this situation the underlying functionality returns nullptr and thus error message is send.

Restricted Application edited projects, added KWin; removed Plasma. · View Herald TranscriptFeb 16 2018, 5:54 AM
Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptFeb 20 2018, 6:56 PM
Restricted Application edited projects, added KWin; removed Plasma. · View Herald TranscriptFeb 21 2018, 5:08 PM
davidedmundson accepted this revision.Feb 22 2018, 7:57 PM
This revision is now accepted and ready to land.Feb 22 2018, 7:57 PM
Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptFeb 22 2018, 7:57 PM
romangg accepted this revision.Feb 24 2018, 8:10 PM
Restricted Application edited projects, added KWin; removed Plasma. · View Herald TranscriptFeb 24 2018, 8:10 PM
This revision was automatically updated to reflect the committed changes.
Restricted Application edited projects, added Plasma; removed KWin. · View Herald TranscriptFeb 25 2018, 1:12 PM