1
0
mirror of https://github.com/KDE/latte-dock.git synced 2025-03-27 14:50:21 +03:00

imrove windowChanged signal under X11

--the new code contains more comments and except
blacklisting all NET::Properties2 signals that are
not accompanied with NET::Properties it also
whitelists specific states for NET::WMState.
This should lower a lot the calculations needed
in order to support the dodge visibility modes.
At the same time apps that are abusing X11 signals
should be ignored totally because the whitelisted
states and NET::Properties are only set by the
user or the window manager.

BUG: 399149
FIXED-IN: 0.8.2
This commit is contained in:
Michail Vourlakos 2018-10-06 16:28:46 +03:00
parent 84261746fa
commit 9613531651

View File

@ -348,20 +348,40 @@ void XWindowInterface::windowChangedProxy(WId wid, NET::Properties prop1, NET::P
const auto winType = KWindowInfo(wid, NET::WMWindowType).windowType(NET::DesktopMask);
//! update desktop id
if (winType != -1 && (winType & NET::Desktop)) {
m_desktopId = wid;
emit windowChanged(wid);
return;
}
//! ignore when, eg: the user presses a key, or a window is sending X events
//! accept only NET::Properties events,
//! ignore when the user presses a key, or a window is sending X events etc.
//! without needing to (e.g. Firefox, https://bugzilla.mozilla.org/show_bug.cgi?id=1389953)
if (prop1 == 0 && (prop2 == NET::WM2UserTime || prop2 == NET::WM2IconPixmap)) {
//! NET::WM2UserTime, NET::WM2IconPixmap etc....
if (prop1 == 0) {
return;
}
if (prop1 && !(prop1 & NET::WMState || prop1 & NET::WMGeometry || prop1 & NET::ActiveWindow))
//! accepty only the following NET:Properties changed signals
//! NET::WMState, NET::WMGeometry, NET::ActiveWindow
if (!((prop1 & NET::WMState) || (prop1 & NET::WMGeometry) || (prop1 & NET::ActiveWindow))) {
return;
}
//! when only WMState changed we can whitelist the acceptable states
if ((prop1 & NET::WMState) && !(prop1 & NET::WMGeometry) && !(prop1 & NET::ActiveWindow)) {
KWindowInfo info(wid, NET::WMState);
if (info.valid()) {
if (!info.hasState(NET::Sticky) && !info.hasState(NET::Shaded)
&& !info.hasState(NET::FullScreen) && !info.hasState(NET::Hidden)) {
return;
}
} else {
return;
}
}
emit windowChanged(wid);
}