diff --git a/manage.cpp b/manage.cpp index 5f3337914f..a8c12e515f 100644 --- a/manage.cpp +++ b/manage.cpp @@ -97,6 +97,7 @@ bool Client::manage(xcb_window_t w, bool isMapped) NET::WM2Protocols | NET::WM2InitialMappingState; + auto wmClientLeaderCookie = fetchWmClientLeader(); info = new WinInfo(this, m_client, rootWindow(), properties, properties2); // If it's already mapped, ignore hint @@ -105,7 +106,7 @@ bool Client::manage(xcb_window_t w, bool isMapped) m_colormap = attr->colormap; getResourceClass(); - getWmClientLeader(); + readWmClientLeader(wmClientLeaderCookie); getWmClientMachine(); getSyncCounter(); // First only read the caption text, so that setupWindowRules() can use it for matching, diff --git a/toplevel.cpp b/toplevel.cpp index 3fdb9fae69..72e2dba877 100644 --- a/toplevel.cpp +++ b/toplevel.cpp @@ -145,10 +145,20 @@ QRect Toplevel::visibleRect() const return r.translated(geometry().topLeft()); } +Xcb::Property Toplevel::fetchWmClientLeader() const +{ + return Xcb::Property(false, window(), atoms->wm_client_leader, XCB_ATOM_WINDOW, 0, 10000); +} + +void Toplevel::readWmClientLeader(Xcb::Property &prop) +{ + wmClientLeaderWin = prop.value(window()); +} + void Toplevel::getWmClientLeader() { - Xcb::Property prop(false, window(), atoms->wm_client_leader, XCB_ATOM_WINDOW, 0, 10000); - wmClientLeaderWin = prop.value(window()); + auto prop = fetchWmClientLeader(); + readWmClientLeader(prop); } /*! diff --git a/toplevel.h b/toplevel.h index 37e14279da..b400f9a389 100644 --- a/toplevel.h +++ b/toplevel.h @@ -414,6 +414,8 @@ protected: virtual void damageNotifyEvent(); void discardWindowPixmap(); void addDamageFull(); + Xcb::Property fetchWmClientLeader() const; + void readWmClientLeader(Xcb::Property &p); void getWmClientLeader(); void getWmClientMachine(); /**