]> Dogcows Code - chaz/openbox/commitdiff
don't make omnipresent windows lose focus when changing desktops. this is done by...
authorDana Jansens <danakj@orodu.net>
Sat, 4 Aug 2007 17:29:13 +0000 (13:29 -0400)
committerDana Jansens <danakj@orodu.net>
Sat, 4 Aug 2007 17:29:13 +0000 (13:29 -0400)
openbox/actions/unfocus.c
openbox/event.c
openbox/focus.c
openbox/focus.h
openbox/screen.c

index 70384f4d2528b4016174aaeedf4bccb6f0196555..0527d2a06d6dd7e986f3d488d9df5d79338fb313 100644 (file)
@@ -12,6 +12,6 @@ void action_unfocus_startup()
 static gboolean run_func(ObActionsData *data, gpointer options)
 {
     if (data->client && data->client == focus_client)
-        focus_fallback(FALSE, FALSE, TRUE);
+        focus_fallback(FALSE, FALSE, TRUE, FALSE);
     return FALSE;
 }
index 148d152ec1838dfc36a88af20d36b56321d07d3c..9c47c04a3a49e42290a94bfea25dd6ba4adb122c 100644 (file)
@@ -489,7 +489,7 @@ static void event_process(const XEvent *ec, gpointer data)
 
             focus_left_screen = FALSE;
 
-            focus_fallback(FALSE, config_focus_under_mouse, TRUE);
+            focus_fallback(FALSE, config_focus_under_mouse, TRUE, 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
@@ -498,10 +498,10 @@ static void event_process(const XEvent *ec, gpointer data)
             /* focus_set_client(NULL) has already been called */
             client_calc_layer(client);
         }
-        if (e->xfocus.detail == NotifyPointerRoot ||
-            e->xfocus.detail == NotifyDetailNone ||
-            e->xfocus.detail == NotifyInferior ||
-            e->xfocus.detail == NotifyNonlinear)
+        else if (e->xfocus.detail == NotifyPointerRoot ||
+                 e->xfocus.detail == NotifyDetailNone ||
+                 e->xfocus.detail == NotifyInferior ||
+                 e->xfocus.detail == NotifyNonlinear)
         {
             XEvent ce;
 
@@ -541,7 +541,8 @@ static void event_process(const XEvent *ec, gpointer data)
                 */
 
                 if (!focus_left_screen)
-                    focus_fallback(FALSE, config_focus_under_mouse, TRUE);
+                    focus_fallback(FALSE, config_focus_under_mouse,
+                                   TRUE, TRUE);
             }
         }
         else if (!client)
@@ -597,7 +598,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, config_focus_under_mouse, TRUE);
+                focus_fallback(TRUE, config_focus_under_mouse, TRUE, TRUE);
             }
         }
 
index 0dafd799b5f2d41e50ca97d295657a9141597966..b056db7e466f3cde9c6b7c7ab4f3db58a011f5ca 100644 (file)
@@ -159,7 +159,7 @@ static ObClient* focus_fallback_target(gboolean allow_refocus,
 }
 
 ObClient* focus_fallback(gboolean allow_refocus, gboolean allow_pointer,
-                         gboolean allow_omnipresent)
+                         gboolean allow_omnipresent, gboolean focus_lost)
 {
     ObClient *new;
     ObClient *old = focus_client;
@@ -167,7 +167,8 @@ ObClient* focus_fallback(gboolean allow_refocus, gboolean allow_pointer,
     /* unfocus any focused clients.. they can be focused by Pointer events
        and such, and then when we try focus them, we won't get a FocusIn
        event at all for them. */
-    focus_nothing();
+    if (focus_lost)
+        focus_nothing();
 
     new = focus_fallback_target(allow_refocus, allow_pointer,
                                 allow_omnipresent, old);
index 93fe6183171e161860545f89c47b1a80bd24d3c0..b8f899940d72047ea1c5fb9c79f4d0f5a369c0a8 100644 (file)
@@ -46,7 +46,8 @@ void focus_nothing();
 /*! Call this when you need to focus something! */
 struct _ObClient* focus_fallback(gboolean allow_refocus,
                                  gboolean allow_pointer,
-                                 gboolean allow_omnipresent);
+                                 gboolean allow_omnipresent,
+                                 gboolean focus_lost);
 
 /*! Add a new client into the focus order */
 void focus_order_add_new(struct _ObClient *c);
index 7e04d4dcef0a2bd61425b10d3dbbf7c2d49d43d5..93ec57f53eb406971e950e7559d0fa74b1cf3bc2 100644 (file)
@@ -560,7 +560,9 @@ static void screen_fallback_focus()
        do this before hiding the windows so if helper windows are coming
        with us, they don't get hidden
     */
-    if ((c = focus_fallback(TRUE, !config_focus_last, allow_omni))) {
+    if ((c = focus_fallback(TRUE, !config_focus_last, allow_omni,
+                            !allow_omni)))
+    {
         /* 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.. */
@@ -1137,7 +1139,7 @@ void screen_show_desktop(gboolean show, ObClient *show_only)
     else if (!show_only) {
         ObClient *c;
 
-        if ((c = focus_fallback(TRUE, FALSE, TRUE))) {
+        if ((c = focus_fallback(TRUE, FALSE, TRUE, FALSE))) {
             /* 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.. */
This page took 0.030644 seconds and 4 git commands to generate.