]> Dogcows Code - chaz/openbox/blobdiff - src/Window.cc
fixes for using ostrstream in gcc3. have to unfreeze the string more. annoying.
[chaz/openbox] / src / Window.cc
index dca583b32c52b373504a98dc557fdc6cb9e1539a..5a28d23254053874f2bb3a565d2de027ed4c4458 100644 (file)
@@ -56,6 +56,9 @@
 #endif // SLIT
 #include "Util.h"
 
+#include <iostream>
+using namespace std;
+
 /*
  * Initializes the class with default values/the window's set initial values.
  */
@@ -1390,7 +1393,7 @@ Bool OpenboxWindow::setInputFocus(void) {
       XSetInputFocus(display, screen->getRootWindow(),
                     RevertToNone, CurrentTime);
 
-    openbox.setFocusedWindow(this);
+    openbox.focusWindow(this);
 
     if (flags.send_focus_message) {
       XEvent ce;
@@ -1452,7 +1455,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 +1473,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 +1530,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();
 
@@ -2243,7 +2243,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;
     }
 
@@ -2288,6 +2289,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);
 
@@ -2323,6 +2327,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;
@@ -2758,6 +2764,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);
This page took 0.022521 seconds and 4 git commands to generate.