X-Git-Url: https://git.dogcows.com/gitweb?a=blobdiff_plain;f=src%2Fclient.cc;h=f83a8a3de4fdb73c79932015c435ba08629d3725;hb=619ad666fc3091a2ec022cbe4d829123ee94398b;hp=4e44d4bc9358794ec0cb3b6206b8acebd8023a59;hpb=4c2f4e75372c4814413e3a105a045395e10892ca;p=chaz%2Fopenbox diff --git a/src/client.cc b/src/client.cc index 4e44d4bc..f83a8a3d 100644 --- a/src/client.cc +++ b/src/client.cc @@ -93,15 +93,24 @@ Client::~Client() void Client::getGravity() { + XSizeHints size; XWindowAttributes wattrib; Status ret; - - ret = XGetWindowAttributes(**otk::display, _window, &wattrib); - assert(ret != BadWindow); - - _gravity = wattrib.win_gravity; + long junk; + + 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() { // defaults to the current desktop @@ -406,7 +415,7 @@ void Client::updateNormalHints() // 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);