]> Dogcows Code - chaz/openbox/blobdiff - src/Window.cc
removed LinkedLists in BaseDisplay and Image. Only 1 left in BaseDisplay now
[chaz/openbox] / src / Window.cc
index cc078fba01b35a408a9d4ad8fa0bc81cc2fc2386..ec042c305ae77e80cb253bdddbb40d7f9ed4afd7 100644 (file)
@@ -1385,12 +1385,12 @@ Bool OpenboxWindow::setInputFocus(void) {
   } else if (! flags.focused) {
     if (focus_mode == F_LocallyActive || focus_mode == F_Passive)
       XSetInputFocus(display, client.window,
-                    RevertToPointerRoot, CurrentTime);
+                      RevertToPointerRoot, CurrentTime);
     else
       XSetInputFocus(display, screen->getRootWindow(),
                     RevertToNone, CurrentTime);
 
-    openbox.setFocusedWindow(this);
+    openbox.focusWindow(this);
 
     if (flags.send_focus_message) {
       XEvent ce;
@@ -1452,7 +1452,7 @@ void OpenboxWindow::iconify(void) {
 }
 
 
-void OpenboxWindow::deiconify(Bool reassoc, Bool raise) {
+void OpenboxWindow::deiconify(bool reassoc, bool raise, bool initial) {
   if (flags.iconic || reassoc)
     screen->reassociateWindow(this, -1, False);
   else if (workspace_number != screen->getCurrentWorkspace()->getWorkspaceID())
@@ -1470,14 +1470,8 @@ void OpenboxWindow::deiconify(Bool reassoc, Bool raise) {
 
   // if we're using the click to place placement type, then immediately
   // after the window is mapped, we need to start interactively moving it
-  if (screen->placementPolicy() == BScreen::ClickMousePlacement &&
-      place_window && !(flags.iconic || reassoc)) {
-    // if the last window wasn't placed yet, or we're just moving a window
-    // already, finish off that move cleanly
-    OpenboxWindow *w = openbox.getFocusedWindow();
-    if (w != (OpenboxWindow *) 0 && w->flags.moving)
-      w->endMove();
-
+  if (initial && place_window &&
+      screen->placementPolicy() == BScreen::ClickMousePlacement) {
     int x, y, rx, ry;
     Window c, r;
     unsigned int m;
@@ -1533,6 +1527,9 @@ void OpenboxWindow::withdraw(void) {
 
 
 void OpenboxWindow::maximize(unsigned int button) {
+  if (flags.moving)
+    endMove();
+  
   // handle case where menu is open then the max button is used instead
   if (windowmenu && windowmenu->isVisible()) windowmenu->hide();
 
@@ -2242,7 +2239,8 @@ void OpenboxWindow::mapRequestEvent(XMapRequestEvent *re) {
     case InactiveState:
     case ZoomState:
     default:
-      deiconify(False);
+      deiconify(False, True, True);     // specify that we're initializing the
+                                        // window
       break;
     }
 
@@ -2287,6 +2285,9 @@ void OpenboxWindow::unmapNotifyEvent(XUnmapEvent *ue) {
     openbox.grab();
     if (! validateClient()) return;
 
+    if (flags.moving)
+      endMove();
+    
     XChangeSaveSet(display, client.window, SetModeDelete);
     XSelectInput(display, client.window, NoEventMask);
 
@@ -2322,6 +2323,8 @@ void OpenboxWindow::unmapNotifyEvent(XUnmapEvent *ue) {
 
 void OpenboxWindow::destroyNotifyEvent(XDestroyWindowEvent *de) {
   if (de->window == client.window) {
+    if (flags.moving)
+      endMove();
     XUnmapWindow(display, frame.window);
 
     delete this;
@@ -2757,6 +2760,11 @@ void OpenboxWindow::buttonReleaseEvent(XButtonEvent *re) {
 void OpenboxWindow::startMove(int x, int y) {
   ASSERT(!flags.moving);
 
+  // make sure only one window is moving at a time
+  OpenboxWindow *w = openbox.getMaskedWindow();
+  if (w != (OpenboxWindow *) 0 && w->flags.moving)
+    w->endMove();
+  
   XGrabPointer(display, frame.window, False, PointerMotionMask |
                ButtonReleaseMask, GrabModeAsync, GrabModeAsync,
                None, openbox.getMoveCursor(), CurrentTime);
@@ -2874,6 +2882,10 @@ void OpenboxWindow::endMove() {
   }
   screen->hideGeometry();
   XUngrabPointer(display, CurrentTime);
+  // if there are any left over motions from the move, drop them now cuz they
+  // cause problems
+  XEvent e;
+  while (XCheckTypedWindowEvent(display, frame.window, MotionNotify, &e));
 }
 
 
@@ -2887,7 +2899,7 @@ void OpenboxWindow::motionNotifyEvent(XMotionEvent *me) {
   else if (functions.resize &&
             (((me->state & Button1Mask) && (me->window == frame.right_grip ||
                                             me->window == frame.left_grip)) ||
-             (me->state & (Mod1Mask | Button3Mask) &&
+             (me->state == (Mod1Mask | Button3Mask) &&
                                             me->window == frame.window))) {
     Bool left = resize_zone & ZoneLeft;
 
@@ -3034,6 +3046,8 @@ void OpenboxWindow::restore(void) {
   XMapWindow(display, client.window);
 
   XFlush(display);
+
+  delete this;
 }
 
 
This page took 0.023165 seconds and 4 git commands to generate.