]> Dogcows Code - chaz/openbox/blobdiff - src/Window.cc
dont let windows get initially mapped when they arent on the current workspace
[chaz/openbox] / src / Window.cc
index 3edc83d1965d39acac37497a306675552acff754..60182ce952e38dbccb224df533d8b570792db4f7 100644 (file)
@@ -142,7 +142,7 @@ BlackboxWindow::BlackboxWindow(Blackbox *b, Window w, BScreen *s) {
 
   functions = Func_Resize | Func_Move | Func_Iconify | Func_Maximize;
   mwm_decorations = Decor_Titlebar | Decor_Handle | Decor_Border |
-                    Decor_Iconify | Decor_Maximize | Decor_Close;
+                    Decor_Iconify | Decor_Maximize;
 
   client.normal_hint_flags = 0;
   client.window_group = None;
@@ -422,13 +422,12 @@ void BlackboxWindow::enableDecor(bool enable) {
 void BlackboxWindow::setupDecor() {
   if (blackbox_attrib.decoration != DecorNone) {
     // start with everything on
-    decorations =
+    decorations = Decor_Close |
       (mwm_decorations & Decor_Titlebar ? Decor_Titlebar : 0) |
       (mwm_decorations & Decor_Border ? Decor_Border : 0) |
       (mwm_decorations & Decor_Handle ? Decor_Handle : 0) |
       (mwm_decorations & Decor_Iconify ? Decor_Iconify : 0) |
-      (mwm_decorations & Decor_Maximize ? Decor_Maximize : 0) |
-      (mwm_decorations & Decor_Close ? Decor_Close : 0);
+      (mwm_decorations & Decor_Maximize ? Decor_Maximize : 0);
 
     if (! (functions & Func_Close)) decorations &= ~Decor_Close;
     if (! (functions & Func_Maximize)) decorations &= ~Decor_Maximize;
@@ -1311,7 +1310,7 @@ void BlackboxWindow::getMWMHints(void) {
   if (mwm_hint->flags & MwmHintsDecorations) {
     if (mwm_hint->decorations & MwmDecorAll) {
       mwm_decorations = Decor_Titlebar | Decor_Handle | Decor_Border |
-                        Decor_Iconify | Decor_Maximize | Decor_Close;
+                        Decor_Iconify | Decor_Maximize;
     } else {
       mwm_decorations = 0;
 
@@ -2612,6 +2611,13 @@ void BlackboxWindow::mapRequestEvent(const XMapRequestEvent *re) {
           client.window);
 #endif // DEBUG
 
+  /*
+     Even thought the window wants to be shown, if it is not on the current
+     workspace, then it isn't going to be shown right now.
+  */
+  if (blackbox_attrib.workspace != screen->getCurrentWorkspaceID())
+    current_state = WithdrawnState;
+
   switch (current_state) {
   case IconicState:
     iconify();
@@ -2630,8 +2636,8 @@ void BlackboxWindow::mapRequestEvent(const XMapRequestEvent *re) {
     if (isNormal()) {
       if (! blackbox->isStartup()) {
         XSync(blackbox->getXDisplay(), False); // make sure the frame is mapped
-        if (screen->doFocusNew()|| (isTransient() && getTransientFor() &&
-                                    getTransientFor()->isFocused())) {
+        if (screen->doFocusNew() || (isTransient() && getTransientFor() &&
+                                     getTransientFor()->isFocused())) {
           setInputFocus();
         }
         if (screen->getPlacementPolicy() == BScreen::ClickMousePlacement) {
@@ -2707,6 +2713,8 @@ void BlackboxWindow::propertyNotifyEvent(const XPropertyEvent *pe) {
     break;
 
   case XA_WM_TRANSIENT_FOR: {
+    bool s = flags.stuck;
+    
     // determine if this is a transient window
     getTransientInfo();
 
@@ -2715,6 +2723,7 @@ void BlackboxWindow::propertyNotifyEvent(const XPropertyEvent *pe) {
       functions &= ~Func_Maximize;
       setAllowedActions();
       setupDecor();
+      if (flags.stuck != s) stick();
     }
 
     reconfigure();
@@ -3612,15 +3621,17 @@ void BlackboxWindow::motionNotifyEvent(const XMotionEvent *me) {
   } else if (flags.resizing) {
     doResize(me->x_root, me->y_root);
   } else {
-    if (!flags.resizing && me->state & Button1Mask && (functions & Func_Move) &&
+    if ((functions & Func_Move) &&
+       (me->state & Button1Mask) &&
         (frame.title == me->window || frame.label == me->window ||
          frame.handle == me->window || frame.window == me->window)) {
       beginMove(me->x_root, me->y_root);
     } else if ((functions & Func_Resize) &&
-               (me->state & Button1Mask && (me->window == frame.right_grip ||
-                                            me->window == frame.left_grip)) ||
-               (me->state & Button3Mask && me->state & mod_mask &&
-                me->window == frame.window)) {
+               ((me->state & Button1Mask) && (me->window == frame.right_grip ||
+                                              me->window == frame.left_grip)) ||
+               ((me->state & Button3Mask) && (me->state & mod_mask) &&
+                (frame.title == me->window || frame.label == me->window ||
+                 frame.handle == me->window || frame.window == me->window))) {
       unsigned int zones = screen->getResizeZones();
       Corner corner;
       
This page took 0.025354 seconds and 4 git commands to generate.