Split Toplevel::getWmClientLeader in two parts

First part (fetch) just creates the Xcb::Property while the
second part (read) reads the property. This allows to better
schedule the commands in Client::manage to reduce the number of
roundtrips. This reduces the time spent for fetching the client
leader property by about half a millisecond on my system.
icc-effect-5.14.5
Martin Gräßlin 2015-01-15 14:33:28 +01:00
parent de573edd1d
commit b27d3d20e7
3 changed files with 16 additions and 3 deletions

View File

@ -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,

View File

@ -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<xcb_window_t>(window());
}
void Toplevel::getWmClientLeader()
{
Xcb::Property prop(false, window(), atoms->wm_client_leader, XCB_ATOM_WINDOW, 0, 10000);
wmClientLeaderWin = prop.value<xcb_window_t>(window());
auto prop = fetchWmClientLeader();
readWmClientLeader(prop);
}
/*!

View File

@ -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();
/**