From fd0fd82ad628b44873c4a9173eb966e75de42dcf Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Martin=20Gr=C3=A4=C3=9Flin?= Date: Mon, 14 Apr 2014 15:32:45 +0200 Subject: [PATCH] Use NETWM to get updates on blocking compositing Adds NET::WM2BlockCompositing to the Client's properties which allows to read the state from the NETWinInfo object and get updates without having to resolve the atom ourselve. REVIEW: 117561 --- atoms.cpp | 1 - atoms.h | 1 - client.cpp | 10 ---------- client.h | 1 - events.cpp | 5 +++-- manage.cpp | 3 ++- 6 files changed, 5 insertions(+), 16 deletions(-) diff --git a/atoms.cpp b/atoms.cpp index ec2c60fcb8..10405cf6ff 100644 --- a/atoms.cpp +++ b/atoms.cpp @@ -51,7 +51,6 @@ Atoms::Atoms() , kde_net_wm_frame_strut(QByteArrayLiteral("_KDE_NET_WM_FRAME_STRUT")) , net_wm_sync_request_counter(QByteArrayLiteral("_NET_WM_SYNC_REQUEST_COUNTER")) , net_wm_sync_request(QByteArrayLiteral("_NET_WM_SYNC_REQUEST")) - , kde_net_wm_block_compositing(QByteArrayLiteral("_KDE_NET_WM_BLOCK_COMPOSITING")) , kde_net_wm_shadow(QByteArrayLiteral("_KDE_NET_WM_SHADOW")) , net_wm_opaque_region(QByteArrayLiteral("_NET_WM_OPAQUE_REGION")) , kde_net_wm_tab_group(QByteArrayLiteral("_KDE_NET_WM_TAB_GROUP")) diff --git a/atoms.h b/atoms.h index 3566d0a389..5f03fdfd29 100644 --- a/atoms.h +++ b/atoms.h @@ -60,7 +60,6 @@ public: Xcb::Atom kde_net_wm_frame_strut; Xcb::Atom net_wm_sync_request_counter; Xcb::Atom net_wm_sync_request; - Xcb::Atom kde_net_wm_block_compositing; Xcb::Atom kde_net_wm_shadow; Xcb::Atom net_wm_opaque_region; Xcb::Atom kde_net_wm_tab_group; diff --git a/client.cpp b/client.cpp index c1ed85e5d4..f117815223 100644 --- a/client.cpp +++ b/client.cpp @@ -2318,16 +2318,6 @@ void Client::updateCursor() } } -void Client::updateCompositeBlocking(bool readProperty) -{ - if (readProperty) { - NETWinInfo i(connection(), window(), rootWindow(), 0, NET::WM2BlockCompositing); - setBlockingCompositing(i.isBlockingCompositing()); - } - else - setBlockingCompositing(blocks_compositing); -} - void Client::setBlockingCompositing(bool block) { const bool usedToBlock = blocks_compositing; diff --git a/client.h b/client.h index db01c552c9..ab6fd83395 100644 --- a/client.h +++ b/client.h @@ -493,7 +493,6 @@ public: virtual void finishCompositing(); void setBlockingCompositing(bool block); inline bool isBlockingCompositing() { return blocks_compositing; } - void updateCompositeBlocking(bool readProperty = false); QString caption(bool full = true, bool stripped = false) const; diff --git a/events.cpp b/events.cpp index 013ee52456..a182f92235 100644 --- a/events.cpp +++ b/events.cpp @@ -526,6 +526,9 @@ bool Client::windowEvent(xcb_generic_event_t *e) if (dirtyProperties2.testFlag(NET::WM2WindowClass)) { getResourceClass(); } + if (dirtyProperties2.testFlag(NET::WM2BlockCompositing)) { + setBlockingCompositing(info->isBlockingCompositing()); + } } const uint8_t eventType = e->response_type & ~0x80; @@ -805,8 +808,6 @@ void Client::propertyNotifyEvent(xcb_property_notify_event_t *e) getSyncCounter(); else if (e->atom == atoms->activities) checkActivities(); - else if (e->atom == atoms->kde_net_wm_block_compositing) - updateCompositeBlocking(true); else if (e->atom == atoms->kde_first_in_window_list) updateFirstInTabBox(); else if (e->atom == atoms->kde_color_sheme) diff --git a/manage.cpp b/manage.cpp index b903e48793..242874f643 100644 --- a/manage.cpp +++ b/manage.cpp @@ -91,6 +91,7 @@ bool Client::manage(xcb_window_t w, bool isMapped) NET::WMPid | NET::WMIconName; const NET::Properties2 properties2 = + NET::WM2BlockCompositing | NET::WM2WindowClass | NET::WM2WindowRole | NET::WM2UserTime | @@ -618,7 +619,7 @@ bool Client::manage(xcb_window_t w, bool isMapped) RuleBook::self()->discardUsed(this, false); // Remove ApplyNow rules updateWindowRules(Rules::All); // Was blocked while !isManaged() - updateCompositeBlocking(true); + setBlockingCompositing(info->isBlockingCompositing()); updateColorScheme(); updateShowOnScreenEdge();