]> Dogcows Code - chaz/openbox/blobdiff - src/Window.cc
remove some debug fprintfs
[chaz/openbox] / src / Window.cc
index 427cc955d8500695bfcf2c1e652e911869472f7d..1f06df63c5a2eaf50b77c37982d849c84953f0b0 100644 (file)
@@ -847,6 +847,10 @@ void BlackboxWindow::grabButtons(void) {
                          ButtonReleaseMask | ButtonMotionMask, GrabModeAsync,
                          GrabModeAsync, frame.window,
                          blackbox->getLowerRightAngleCursor());
+  // alt+middle lowers the window
+  blackbox->grabButton(Button2, Mod1Mask, frame.window, True,
+                       ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
+                       frame.window, None);
 }
 
 
@@ -855,6 +859,7 @@ void BlackboxWindow::ungrabButtons(void) {
     blackbox->ungrabButton(Button1, 0, frame.plate);
 
   blackbox->ungrabButton(Button1, Mod1Mask, frame.window);
+  blackbox->ungrabButton(Button2, Mod1Mask, frame.window);
   blackbox->ungrabButton(Button3, Mod1Mask, frame.window);
 }
 
@@ -2216,7 +2221,7 @@ void BlackboxWindow::applyGravity(Rect &r) {
   case NorthEastGravity:
   case SouthEastGravity:
   case EastGravity:
-    r.setX(client.rect.x() - frame.margin.left - frame.margin.right);
+    r.setX(client.rect.x() - frame.margin.left - frame.margin.right + 2);
     break;
 
   case ForgetGravity:
@@ -2243,7 +2248,7 @@ void BlackboxWindow::applyGravity(Rect &r) {
   case SouthWestGravity:
   case SouthEastGravity:
   case SouthGravity:
-    r.setY(client.rect.y() - frame.margin.top - frame.margin.bottom);
+    r.setY(client.rect.y() - frame.margin.top - frame.margin.bottom + 2);
     break;
 
   case ForgetGravity:
@@ -2279,7 +2284,7 @@ void BlackboxWindow::restoreGravity(Rect &r) {
   case NorthEastGravity:
   case SouthEastGravity:
   case EastGravity:
-    r.setX(frame.rect.x() + frame.margin.left + frame.margin.right);
+    r.setX(frame.rect.x() + frame.margin.left + frame.margin.right - 2);
     break;
 
   case ForgetGravity:
@@ -2306,7 +2311,7 @@ void BlackboxWindow::restoreGravity(Rect &r) {
   case SouthWestGravity:
   case SouthEastGravity:
   case SouthGravity:
-    r.setY(frame.rect.y() + frame.margin.top + frame.margin.bottom);
+    r.setY(frame.rect.y() + frame.margin.top + frame.margin.bottom - 2);
     break;
 
   case ForgetGravity:
@@ -2821,6 +2826,9 @@ void BlackboxWindow::buttonReleaseEvent(const XButtonEvent *re) {
     endMove();
   } else if (flags.resizing) {
     endResize();
+  } else if (re->window == frame.window) {
+    if (re->button == 2 && re->state == Mod1Mask)
+      XUngrabPointer(blackbox->getXDisplay(), CurrentTime);
   }
 }
 
@@ -3113,6 +3121,7 @@ void BlackboxWindow::beginResize(int x_root, int y_root, Corner dir) {
 
   default:
     assert(false); // unhandled Corner
+    return;        // unreachable, for the compiler
   }
   
   XGrabServer(blackbox->getXDisplay());
@@ -3151,29 +3160,30 @@ void BlackboxWindow::doResize(int x_root, int y_root) {
   Corner anchor;
 
   switch (resize_dir) {
-    case BottomLeft:
-      anchor = TopRight;
-      frame.changing.setSize(frame.rect.width() - (x_root - frame.grab_x),
-                             frame.rect.height() + (y_root - frame.grab_y));
-      break;
-    case BottomRight:
-      anchor = TopLeft;
-      frame.changing.setSize(frame.rect.width() + (x_root - frame.grab_x),
-                             frame.rect.height() + (y_root - frame.grab_y));
-      break;
-    case TopLeft:
-      anchor = BottomRight;
-      frame.changing.setSize(frame.rect.width() - (x_root - frame.grab_x),
-                             frame.rect.height() - (y_root - frame.grab_y));
-      break;
-    case TopRight:
-      anchor = BottomLeft;
-      frame.changing.setSize(frame.rect.width() + (x_root - frame.grab_x),
-                             frame.rect.height() - (y_root - frame.grab_y));
-      break;
+  case BottomLeft:
+    anchor = TopRight;
+    frame.changing.setSize(frame.rect.width() - (x_root - frame.grab_x),
+                           frame.rect.height() + (y_root - frame.grab_y));
+    break;
+  case BottomRight:
+    anchor = TopLeft;
+    frame.changing.setSize(frame.rect.width() + (x_root - frame.grab_x),
+                           frame.rect.height() + (y_root - frame.grab_y));
+    break;
+  case TopLeft:
+    anchor = BottomRight;
+    frame.changing.setSize(frame.rect.width() - (x_root - frame.grab_x),
+                           frame.rect.height() - (y_root - frame.grab_y));
+    break;
+  case TopRight:
+    anchor = BottomLeft;
+    frame.changing.setSize(frame.rect.width() + (x_root - frame.grab_x),
+                           frame.rect.height() - (y_root - frame.grab_y));
+    break;
 
-    default:
-      assert(false); // unhandled Corner
+  default:
+    assert(false); // unhandled Corner
+    return;        // unreachable, for the compiler
   }
   
   constrain(anchor, &gw, &gh);
This page took 0.02356 seconds and 4 git commands to generate.