kdeui: simplify compositor ownership check in KWindowSystemPrivate::x11Event()

it does not matter what window the event is comming from when it comes to
the compositor atom - it is supposed to be only one

Signed-off-by: Ivailo Monev <xakepa10@gmail.com>
This commit is contained in:
Ivailo Monev 2023-06-07 06:51:11 +03:00
parent f6268257c0
commit 43239c5d96

View file

@ -160,32 +160,17 @@ bool KWindowSystemPrivate::x11Event( XEvent * ev )
#ifdef HAVE_XFIXES
if ( haveXfixes && ev->type == xfixesEventBase + XFixesSelectionNotify ) {
if ( ev->xany.window == winId() ) {
XFixesSelectionNotifyEvent *event = reinterpret_cast<XFixesSelectionNotifyEvent*>(ev);
bool haveOwner = event->owner != None;
if (compositingEnabled != haveOwner) {
compositingEnabled = haveOwner;
emit s_q->compositingChanged( compositingEnabled );
}
return true;
}
// Qt compresses XFixesSelectionNotifyEvents without caring about the actual window
// gui/kernel/qapplication_x11.cpp
// until that can be assumed fixed, we also react on events on the root (caused by Qts own compositing tracker)
if ( ev->xany.window == QX11Info::appRootWindow() ) {
XFixesSelectionNotifyEvent *event = reinterpret_cast<XFixesSelectionNotifyEvent*>(ev);
if (event->selection == net_wm_cm) {
bool haveOwner = event->owner != None;
const bool haveOwner = XGetSelectionOwner(QX11Info::display(), net_wm_cm) != None;
if (compositingEnabled != haveOwner) {
compositingEnabled = haveOwner;
emit s_q->compositingChanged( compositingEnabled );
}
// NOTICE this is not our event, we just randomly captured it from Qt -> pass on
// NOTICE this is not our event, we just randomly captured it from Katie -> pass on
return false;
}
}
return false;
}
#endif
if ( ev->xany.window == QX11Info::appRootWindow() ) {