]> Dogcows Code - chaz/openbox/blobdiff - src/client.cc
add drag_threshold
[chaz/openbox] / src / client.cc
index 829bec3649bfa38e087b1130ff43765e26694176..1c411adb7893b58bb50a4a3eb688e478d8c160c3 100644 (file)
@@ -47,7 +47,6 @@ Client::Client(int screen, Window window)
   // pick a layer to start from
   _layer = Layer_Normal;
   
-  getGravity();
   getArea();
   getDesktop();
 
@@ -61,6 +60,8 @@ Client::Client(int screen, Window window)
   getShaped();
 
   updateProtocols();
+  getGravity(); // get the attribute gravity
+  updateNormalHints(); // this may override the attribute gravity
   updateWMHints();
   updateTitle();
   updateIconTitle();
@@ -93,23 +94,15 @@ Client::~Client()
 
 void Client::getGravity()
 {
-  XSizeHints size;
   XWindowAttributes wattrib;
   Status ret;
-  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;
-  }
+
+  ret = XGetWindowAttributes(**otk::display, _window, &wattrib);
+  assert(ret != BadWindow);
+  _gravity = wattrib.win_gravity;
 }
 
+
 void Client::getDesktop()
 {
   // defaults to the current desktop
@@ -414,7 +407,7 @@ void Client::updateNormalHints()
       
       // if the client has a frame, i.e. has already been mapped and is
       // changing its gravity
-      if (_gravity != oldgravity) {
+      if (frame && _gravity != oldgravity) {
         // move our idea of the client's position based on its new gravity
         int x, y;
         frame->frameGravity(x, y);
@@ -779,9 +772,6 @@ void Client::toggleClientBorder(bool addborder)
   case NorthWestGravity:
   case WestGravity:
   case SouthWestGravity:
-  case NorthGravity:
-  case CenterGravity:
-  case SouthGravity:
     break;
   case NorthEastGravity:
   case EastGravity:
@@ -789,6 +779,9 @@ void Client::toggleClientBorder(bool addborder)
     if (addborder) x -= _border_width * 2;
     else           x += _border_width * 2;
     break;
+  case NorthGravity:
+  case SouthGravity:
+  case CenterGravity:
   case ForgetGravity:
   case StaticGravity:
     if (addborder) x -= _border_width;
@@ -798,11 +791,8 @@ void Client::toggleClientBorder(bool addborder)
   switch(_gravity) {
   default:
   case NorthWestGravity:
-  case WestGravity:
   case NorthGravity:
-  case CenterGravity:
   case NorthEastGravity:
-  case EastGravity:
     break;
   case SouthWestGravity:
   case SouthGravity:
@@ -810,6 +800,9 @@ void Client::toggleClientBorder(bool addborder)
     if (addborder) y -= _border_width * 2;
     else           y += _border_width * 2;
     break;
+  case WestGravity:
+  case EastGravity:
+  case CenterGravity:
   case ForgetGravity:
   case StaticGravity:
     if (addborder) y -= _border_width;
This page took 0.025882 seconds and 4 git commands to generate.