all repos — openbox @ 4c2f4e75372c4814413e3a105a045395e10892ca

openbox fork - make it a bit more like ryudo

add a getGravity function to get the gravity from the window attributes initially
Dana Jansens danakj@orodu.net
commit

4c2f4e75372c4814413e3a105a045395e10892ca

parent

d17b86a41f13b9e01b9adef3190a2d3bb022f6a5

2 files changed, 25 insertions(+), 12 deletions(-)

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

@@ -47,6 +47,7 @@ _transient_for = 0;

// pick a layer to start from _layer = Layer_Normal; + getGravity(); getArea(); getDesktop();

@@ -60,7 +61,6 @@ getState();

getShaped(); updateProtocols(); - updateNormalHints(); updateWMHints(); updateTitle(); updateIconTitle();

@@ -90,6 +90,17 @@ otk::Property::erase(_window, otk::Property::atoms.net_wm_state);

} } + +void Client::getGravity() +{ + XWindowAttributes wattrib; + Status ret; + + ret = XGetWindowAttributes(**otk::display, _window, &wattrib); + assert(ret != BadWindow); + + _gravity = wattrib.win_gravity; +} void Client::getDesktop() {

@@ -378,7 +389,6 @@ long ret;

int oldgravity = _gravity; // defaults - _gravity = NorthWestGravity; _size_inc.setPoint(1, 1); _base_size.setPoint(0, 0); _min_size.setPoint(0, 0);

@@ -391,8 +401,18 @@ // get the hints from the window

if (XGetWMNormalHints(**otk::display, _window, &size, &ret)) { _positioned = (size.flags & (PPosition|USPosition)); - if (size.flags & PWinGravity) + if (size.flags & PWinGravity) { _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) { + // move our idea of the client's position based on its new gravity + int x, y; + frame->frameGravity(x, y); + _area.setPos(x, y); + } + } if (size.flags & PMinSize) _min_size.setPoint(size.min_width, size.min_height);

@@ -405,15 +425,6 @@ _base_size.setPoint(size.base_width, size.base_height);

if (size.flags & PResizeInc) _size_inc.setPoint(size.width_inc, size.height_inc); - } - - // if the client has a frame, i.e. has already been mapped and is - // changing its gravity - if (frame && _gravity != oldgravity) { - // move our idea of the client's position based on its new gravity - int x, y; - frame->frameGravity(x, y); - _area.setPos(x, y); } }
M src/client.hhsrc/client.hh

@@ -311,6 +311,8 @@ modify this window.

*/ FunctionFlags _functions; + //! Retrieves the window's initial gravity + void getGravity(); //! Retrieves the desktop hint's value and sets Client::_desktop void getDesktop(); //! Retrieves the window's type and sets Client::_type