]> Dogcows Code - chaz/openbox/commitdiff
try use the gravity in the WM_NORMAL hint, and fall back to the attribute
authorDana Jansens <danakj@orodu.net>
Fri, 17 Jan 2003 02:48:29 +0000 (02:48 +0000)
committerDana Jansens <danakj@orodu.net>
Fri, 17 Jan 2003 02:48:29 +0000 (02:48 +0000)
src/client.cc

index 4e44d4bc9358794ec0cb3b6206b8acebd8023a59..829bec3649bfa38e087b1130ff43765e26694176 100644 (file)
@@ -93,13 +93,21 @@ 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()
@@ -406,7 +414,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);
This page took 0.027115 seconds and 4 git commands to generate.