]> Dogcows Code - chaz/openbox/blobdiff - src/Window.cc
better logic when changing a window's decoration level, for choosing what elements...
[chaz/openbox] / src / Window.cc
index 3fc0f43d92b7457cd6b85b44155b413d221a743c..4ced0046f8e90b2023232c689fb3148dea238aad 100644 (file)
@@ -216,7 +216,7 @@ OpenboxWindow::OpenboxWindow(Openbox &o, Window w, BScreen *s) : openbox(o) {
   }
   upsize();
 
-  Bool place_window = True;
+  place_window = true;
   if (openbox.isStartup() || flags.transient ||
       client.normal_hint_flags & (PPosition|USPosition)) {
     setGravityOffsets();
@@ -226,7 +226,7 @@ OpenboxWindow::OpenboxWindow(Openbox &o, Window w, BScreen *s) : openbox(o) {
         (signed) (frame.y + frame.y_border) >= 0 &&
         frame.x <= (signed) screen->size().w() &&
         frame.y <= (signed) screen->size().h()))
-      place_window = False;
+      place_window = false;
   }
 
   frame.window = createToplevelWindow(frame.x, frame.y, frame.width,
@@ -1422,6 +1422,9 @@ Bool OpenboxWindow::setInputFocus(void) {
 void OpenboxWindow::iconify(void) {
   if (flags.iconic) return;
 
+  if (flags.moving)
+    endMove();
+
   if (windowmenu) windowmenu->hide();
 
   setState(IconicState);
@@ -1465,6 +1468,24 @@ void OpenboxWindow::deiconify(Bool reassoc, Bool raise) {
   XMapSubwindows(display, frame.window);
   XMapWindow(display, frame.window);
 
+  // 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();
+
+    int x, y, rx, ry;
+    Window c, r;
+    unsigned int m;
+    XQueryPointer(openbox.getXDisplay(), screen->getRootWindow(),
+                  &r, &c, &rx, &ry, &x, &y, &m);
+    startMove(rx, ry);
+  }
+  
   if (flags.iconic && screen->focusNew()) setInputFocus();
 
   flags.visible = True;
@@ -1494,6 +1515,9 @@ void OpenboxWindow::close(void) {
 
 
 void OpenboxWindow::withdraw(void) {
+  if (flags.moving)
+    endMove();
+
   flags.visible = False;
   flags.iconic = False;
 
@@ -1722,6 +1746,7 @@ void OpenboxWindow::setFocusFlag(Bool focus) {
 
   if (screen->sloppyFocus() && screen->autoRaise() && timer->isTiming())
     timer->stop();
+
 }
 
 
@@ -3066,21 +3091,25 @@ void OpenboxWindow::changeOpenboxHints(OpenboxHints *net) {
 
     default:
     case DecorNormal:
-      decorations.titlebar = decorations.border = decorations.handle =
-       decorations.iconify = decorations.maximize = decorations.menu = True;
+      decorations.titlebar = decorations.iconify = decorations.menu =
+        decorations.border = True;
+      decorations.handle = (functions.resize && !flags.transient);
+      decorations.maximize = functions.maximize;
 
       break;
 
     case DecorTiny:
       decorations.titlebar = decorations.iconify = decorations.menu = True;
-      decorations.border = decorations.handle = decorations.maximize = False;
+      decorations.border = decorations.border = decorations.handle = False;
+      decorations.maximize = functions.maximize;
+
       break;
 
     case DecorTool:
-      decorations.titlebar = decorations.menu = functions.move = True;
-      decorations.iconify = decorations.border = decorations.handle =
-       decorations.maximize = False;
+      decorations.titlebar = decorations.menu = True;
+      decorations.iconify = decorations.border = False;
+      decorations.handle = (functions.resize && !flags.transient);
+      decorations.maximize = functions.maximize;
 
       break;
     }
This page took 0.022 seconds and 4 git commands to generate.