merge 7347-51 from trunk
authorDana Jansens <danakj@orodu.net>
Mon, 4 Jun 2007 22:26:09 +0000 (22:26 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 4 Jun 2007 22:26:09 +0000 (22:26 +0000)
openbox/action.c
openbox/client.c
openbox/event.c
openbox/focus.c
openbox/focus.h
openbox/place.c
openbox/screen.c

index 80b563f9619a9a139b3ff82b0c8d5797e5100011..2b80f1df54e348f9553e310f37ca49578e0ea5b4 100644 (file)
@@ -1314,7 +1314,7 @@ void action_focus(union ActionData *data)
 void action_unfocus (union ActionData *data)
 {
     if (data->client.any.c == focus_client)
-        focus_fallback(FALSE, FALSE);
+        focus_fallback(FALSE, FALSE, TRUE);
 }
 
 void action_iconify(union ActionData *data)
index daa65379f3d50e4201a60c7ea0f91976c3ed7126..ee8001c9cda89b77e395a1a816c361a2e344beec 100644 (file)
@@ -1152,6 +1152,9 @@ static void client_get_desktop(ObClient *self)
 
                 for (it = self->group->members; it; it = g_slist_next(it)) {
                     ObClient *c = it->data;
+
+                    if (c->desktop == DESKTOP_ALL) continue;
+
                     if (c != self) {
                         if (first) {
                             all = c->desktop;
@@ -3519,10 +3522,6 @@ gboolean client_focus(ObClient *self)
     self = client_focus_target(self);
 
     if (!client_can_focus(self)) {
-        if (!self->frame->visible) {
-            /* update the focus lists */
-            focus_order_to_top(self);
-        }
         ob_debug_type(OB_DEBUG_FOCUS,
                       "Client %s can't be focused\n", self->title);
         return FALSE;
index 97b0da84e69309ebe1ca2921a4888e844760b755..e7e3326f6150da463dbe406cf1ea30edca371002 100644 (file)
@@ -499,7 +499,7 @@ static void event_process(const XEvent *ec, gpointer data)
 
             focus_left_screen = FALSE;
 
-            focus_fallback(FALSE, FALSE);
+            focus_fallback(FALSE, FALSE, TRUE);
 
             /* We don't get a FocusOut for this case, because it's just moving
                from our Inferior up to us. This happens when iconifying a
@@ -551,7 +551,7 @@ static void event_process(const XEvent *ec, gpointer data)
                 */
 
                 if (!focus_left_screen)
-                    focus_fallback(FALSE, FALSE);
+                    focus_fallback(FALSE, FALSE, TRUE);
             }
         }
         else if (!client)
@@ -607,7 +607,7 @@ static void event_process(const XEvent *ec, gpointer data)
                 ob_debug_type(OB_DEBUG_FOCUS,
                               "Focus went to an unmanaged window 0x%x !\n",
                               ce.xfocus.window);
-                focus_fallback(TRUE, FALSE);
+                focus_fallback(TRUE, FALSE, TRUE);
             }
         }
 
index 93058d555fe7bcf0f4b73eaa510522e86ffffb19..303388bec210d146accfe5cdf10585f96bc83ebb 100644 (file)
@@ -97,6 +97,7 @@ void focus_set_client(ObClient *client)
 
 static ObClient* focus_fallback_target(gboolean allow_refocus,
                                        gboolean allow_pointer,
+                                       gboolean allow_omnipresent,
                                        ObClient *old)
 {
     GList *it;
@@ -118,12 +119,13 @@ static ObClient* focus_fallback_target(gboolean allow_refocus,
         c = it->data;
         /* fallback focus to a window if:
            1. it is on the current desktop. this ignores omnipresent
-           windows, which are problematic in their own rite.
+           windows, which are problematic in their own rite, unless they are
+           specifically allowed
            2. it is a normal type window, don't fall back onto a dock or
            a splashscreen or a desktop window (save the desktop as a
            backup fallback though)
         */
-        if (c->desktop == screen_desktop &&
+        if ((allow_omnipresent || c->desktop == screen_desktop) &&
             client_normal(c) &&
             (allow_refocus || client_focus_target(c) != old) &&
             client_focus(c))
@@ -155,7 +157,8 @@ static ObClient* focus_fallback_target(gboolean allow_refocus,
     return NULL;
 }
 
-ObClient* focus_fallback(gboolean allow_refocus, gboolean allow_pointer)
+ObClient* focus_fallback(gboolean allow_refocus, gboolean allow_pointer,
+                         gboolean allow_omnipresent)
 {
     ObClient *new;
     ObClient *old = focus_client;
@@ -165,7 +168,8 @@ ObClient* focus_fallback(gboolean allow_refocus, gboolean allow_pointer)
        event at all for them. */
     focus_nothing();
 
-    new = focus_fallback_target(allow_refocus, allow_pointer, old);
+    new = focus_fallback_target(allow_refocus, allow_pointer,
+                                allow_omnipresent, old);
     /* get what was really focused */
     if (new) new = client_focus_target(new);
 
index be7a042d16ee5171562e82fab0744e03899e6531..f54da05cb803e97a2c934b5dab3050602c1c5c3f 100644 (file)
@@ -45,7 +45,8 @@ void focus_nothing();
 
 /*! Call this when you need to focus something! */
 struct _ObClient* focus_fallback(gboolean allow_refocus,
-                                 gboolean allow_pointer);
+                                 gboolean allow_pointer,
+                                 gboolean allow_omnipresent);
 
 /*! Add a new client into the focus order */
 void focus_order_add_new(struct _ObClient *c);
index ea131bea3e1e73de60d99e05633436f144c77c4f..5164675d57048a931192430d7309e6d120392152 100644 (file)
@@ -69,7 +69,9 @@ static Rect **pick_head(ObClient *c)
         choice[i] = screen_num_monitors; /* make them all invalid to start */
 
     /* try direct parent first */
-    if (c->transient_for && c->transient_for != OB_TRAN_GROUP) {
+    if (c->transient_for && c->transient_for != OB_TRAN_GROUP &&
+        client_normal(c->transient_for))
+    {
         add_choice(choice, client_monitor(c->transient_for));
         ob_debug("placement adding choice %d for parent\n",
                  client_monitor(c->transient_for));
@@ -445,7 +447,10 @@ static gboolean place_per_app_setting(ObClient *client, gint *x, gint *y,
 static gboolean place_transient_splash(ObClient *client, gint *x, gint *y)
 {
     if (client->transient_for && client->type == OB_CLIENT_TYPE_DIALOG) {
-        if (client->transient_for != OB_TRAN_GROUP && !client->iconic) {
+        if (client->transient_for != OB_TRAN_GROUP &&
+            client_normal(client->transient_for) &&
+            !client->iconic)
+        {
             ObClient *c = client;
             ObClient *p = client->transient_for;
 
index 5f1991d39b10bd4b6665119ee5624cb01072ee88..9cfc1850250455c33f928d52224196d888f06792 100644 (file)
@@ -587,7 +587,7 @@ void screen_set_desktop(guint num, gboolean dofocus)
        do this before hiding the windows so if helper windows are coming
        with us, they don't get hidden
     */
-    if (dofocus && (c = focus_fallback(TRUE, !config_focus_last)))
+    if (dofocus && (c = focus_fallback(TRUE, !config_focus_last, FALSE)))
     {
         /* only do the flicker reducing stuff ahead of time if we are going
            to call xsetinputfocus on the window ourselves. otherwise there is
@@ -1050,7 +1050,7 @@ void screen_show_desktop(gboolean show, ObClient *show_only)
     else if (!show_only) {
         ObClient *c;
 
-        if ((c = focus_fallback(TRUE, FALSE))) {
+        if ((c = focus_fallback(TRUE, FALSE, TRUE))) {
             /* only do the flicker reducing stuff ahead of time if we are going
                to call xsetinputfocus on the window ourselves. otherwise there
                is no guarantee the window will actually take focus.. */