merge r6053-6058 from trunk
authorDana Jansens <danakj@orodu.net>
Sat, 5 May 2007 02:39:46 +0000 (02:39 +0000)
committerDana Jansens <danakj@orodu.net>
Sat, 5 May 2007 02:39:46 +0000 (02:39 +0000)
openbox/action.c
openbox/client.c
openbox/focus.c
openbox/moveresize.c

index 249dec07dcef7f8f458d92a45b84b2002316c5d8..c91ea3c727275355da4b1c21d1ddaf52dee66531 100644 (file)
@@ -1098,16 +1098,29 @@ void action_run_list(GSList *acts, ObClient *c, ObFrameContext context,
             if (a->data.any.interactive || a->func == action_moveresize) {
                 /* interactive actions are not queued */
                 a->func(&a->data);
-            } else if (context == OB_FRAME_CONTEXT_CLIENT ||
-                       (c && c->type == OB_CLIENT_TYPE_DESKTOP &&
-                        context == OB_FRAME_CONTEXT_DESKTOP)) {
+            } else if ((context == OB_FRAME_CONTEXT_CLIENT ||
+                        (c && c->type == OB_CLIENT_TYPE_DESKTOP &&
+                         context == OB_FRAME_CONTEXT_DESKTOP)) &&
+                       (a->func == action_focus ||
+                        a->func == action_activate))
+            {
                 /* XXX MORE UGLY HACK
                    actions from clicks on client windows are NOT queued.
                    this solves the mysterious click-and-drag-doesnt-work
                    problem. it was because the window gets focused and stuff
                    after the button event has already been passed through. i
                    dont really know why it should care but it does and it makes
-                   a difference. */
+                   a difference.
+
+                   however this very bogus ! !
+                   we want to send the button press to the window BEFORE
+                   we do the action because the action might move the windows
+                   (eg change desktops) and then the button press ends up on
+                   the completely wrong window !
+                   so, this is just for that bug, and it will only NOT queue it
+                   if it is a focusing action that can be used with the mouse
+                   pointer. ugh.
+                */
                 a->func(&a->data);
             } else
                 ob_main_loop_queue_action(ob_main_loop, a);
index 1714e29c7da7950958bb5f0a42cdef02393900ce..c0323c2628d15f0b993f9b0cb587cfdbeba6a3fd 100644 (file)
@@ -931,7 +931,7 @@ static void client_get_all(ObClient *self)
 
     client_update_wmhints(self);
     /* this may have already been called from client_update_wmhints */
-    if (self->transient && self->transient_for == NULL)
+    if (self->transient_for == NULL)
         client_update_transient_for(self);
     client_get_startup_id(self);
     client_get_desktop(self);/* uses transient data/group/startup id if a
@@ -1179,15 +1179,14 @@ void client_update_transient_for(ObClient *self)
                 }
             }
         }
-    } else if (self->group) {
-        if (self->type == OB_CLIENT_TYPE_DIALOG ||
-            self->type == OB_CLIENT_TYPE_TOOLBAR ||
-            self->type == OB_CLIENT_TYPE_MENU ||
-            self->type == OB_CLIENT_TYPE_UTILITY)
-        {
-            self->transient = TRUE;
+    } else if (self->type == OB_CLIENT_TYPE_DIALOG ||
+               self->type == OB_CLIENT_TYPE_TOOLBAR ||
+               self->type == OB_CLIENT_TYPE_MENU ||
+               self->type == OB_CLIENT_TYPE_UTILITY)
+    {
+        self->transient = TRUE;
+        if (self->group)
             target = OB_TRAN_GROUP;
-        }
     } else
         self->transient = FALSE;
 
@@ -1281,7 +1280,7 @@ static void client_update_transient_tree(ObClient *self,
              !client_is_direct_child(self, newparent))
         newparent->transients = g_slist_append(newparent->transients, self);
 
-    /* If the group changed then we need to add any old group transient
+    /* If the group changed then we need to add any new group transient
        windows to our children. But if we're transient for the group, then
        other group transients are not our children.
 
index b1e312361152c733712a9d6d6dfa816e2bb962e5..823435c9df69d85c97e942f42c7060044726f30d 100644 (file)
@@ -475,13 +475,20 @@ static gboolean valid_focus_target(ObClient *ft, gboolean dock_windows)
     else
         ok = (ft->type == OB_CLIENT_TYPE_NORMAL ||
               ft->type == OB_CLIENT_TYPE_DIALOG ||
-              (!client_has_application_group_siblings(ft) &&
-               (ft->type == OB_CLIENT_TYPE_TOOLBAR ||
+              ((ft->type == OB_CLIENT_TYPE_TOOLBAR ||
                 ft->type == OB_CLIENT_TYPE_MENU ||
-                ft->type == OB_CLIENT_TYPE_UTILITY)));
+                ft->type == OB_CLIENT_TYPE_UTILITY) &&
+               /* let alt-tab go to these windows when a window in its group
+                  already has focus ... */
+               ((focus_client && ft->group == focus_client->group) ||
+                /* ... or if there are no application windows in its group */
+                !client_has_application_group_siblings(ft))));
     ok = ok && (ft->can_focus || ft->focus_notify);
-    if (!dock_windows) /* use dock windows that skip taskbar too */
-        ok = ok && !ft->skip_taskbar;
+    if (!dock_windows && /* use dock windows that skip taskbar too */
+        !(ft->type == OB_CLIENT_TYPE_TOOLBAR || /* also, if we actually are */
+          ft->type == OB_CLIENT_TYPE_MENU ||    /* being allowed to target */
+          ft->type == OB_CLIENT_TYPE_UTILITY))  /* one of these, don't let */
+        ok = ok && !ft->skip_taskbar;           /*  skip taskbar stop us */
     ok = ok && (ft->desktop == screen_desktop || ft->desktop == DESKTOP_ALL);
     ok = ok && ft == client_focus_target(ft);
     return ok;
index afd0de2abbf11086b318599f6a5b533638f289e6..868c0c25ceb2477906cd21bbf8a296fbe8d9ecbd 100644 (file)
@@ -407,12 +407,12 @@ gboolean moveresize_event(XEvent *e)
             start_y = e->xbutton.y_root;
             button = e->xbutton.button; /* this will end it now */
         }
-        used = TRUE;
+        used = e->xbutton.button == button;
     } else if (e->type == ButtonRelease) {
         if (!button || e->xbutton.button == button) {
             moveresize_end(FALSE);
+            used = TRUE;
         }
-        used = TRUE;
     } else if (e->type == MotionNotify) {
         if (moving) {
             cur_x = start_cx + e->xmotion.x_root - start_x;