all repos — openbox @ b8ae2f393f0baa17c2e5882504a938029d2933ff

openbox fork - make it a bit more like ryudo

try use the gravity in the WM_NORMAL hint, and fall back to the attribute
Dana Jansens danakj@orodu.net
commit

b8ae2f393f0baa17c2e5882504a938029d2933ff

parent

4c2f4e75372c4814413e3a105a045395e10892ca

1 files changed, 13 insertions(+), 5 deletions(-)

jump to
M src/client.ccsrc/client.cc

@@ -93,13 +93,21 @@

void Client::getGravity() { + XSizeHints size; XWindowAttributes wattrib; Status ret; - - ret = XGetWindowAttributes(**otk::display, _window, &wattrib); - assert(ret != BadWindow); + long junk; - _gravity = wattrib.win_gravity; + if (XGetWMNormalHints(**otk::display, _window, &size, &junk) && + size.flags & PWinGravity) + // first try the normal hints + _gravity = size.win_gravity; + else { + // then fall back to the attribute + ret = XGetWindowAttributes(**otk::display, _window, &wattrib); + assert(ret != BadWindow); + _gravity = wattrib.win_gravity; + } } void Client::getDesktop()

@@ -406,7 +414,7 @@ _gravity = size.win_gravity;

// if the client has a frame, i.e. has already been mapped and is // changing its gravity - if (frame && _gravity != oldgravity) { + if (_gravity != oldgravity) { // move our idea of the client's position based on its new gravity int x, y; frame->frameGravity(x, y);