]> Dogcows Code - chaz/openbox/commitdiff
make focuslast only apply to switching desktops, like 3.3.1
authorDana Jansens <danakj@orodu.net>
Sun, 27 May 2007 22:50:40 +0000 (22:50 +0000)
committerDana Jansens <danakj@orodu.net>
Sun, 27 May 2007 22:50:40 +0000 (22:50 +0000)
openbox/action.c
openbox/event.c
openbox/focus.c
openbox/focus.h
openbox/screen.c

index 6e4cd186ed8d6642e4c5d78e2ac5a0a6e6c2bcb1..a01f4d061724b5e5bac25ea156438fff2393bef8 100644 (file)
@@ -1311,7 +1311,7 @@ void action_focus(union ActionData *data)
 void action_unfocus (union ActionData *data)
 {
     if (data->client.any.c == focus_client)
-        focus_fallback(FALSE);
+        focus_fallback(FALSE, FALSE);
 }
 
 void action_iconify(union ActionData *data)
index ac5919ed8b74985cafc4df819992779d332408e3..9eaec027758df48d3ec127fa2bd533a07fa9fd81 100644 (file)
@@ -516,7 +516,7 @@ static void event_process(const XEvent *ec, gpointer data)
                 */
 
                 if (!focus_left_screen)
-                    focus_fallback(TRUE);
+                    focus_fallback(TRUE, FALSE);
             }
         }
         else if (!client)
@@ -570,7 +570,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);
+                focus_fallback(TRUE, FALSE);
             }
         }
 
index 6713d98dd7566535fe8d81cb5d4d0e0a502af652..59dd0d0d4f8eccbb230cdeb9ff53781e36493fe5 100644 (file)
@@ -95,13 +95,15 @@ void focus_set_client(ObClient *client)
     }
 }
 
-static ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old)
+static ObClient* focus_fallback_target(gboolean allow_refocus,
+                                       gboolean allow_pointer,
+                                       ObClient *old)
 {
     GList *it;
     ObClient *c;
 
     ob_debug_type(OB_DEBUG_FOCUS, "trying pointer stuff\n");
-    if (config_focus_follow && !config_focus_last)
+    if (allow_pointer && config_focus_follow)
         if ((c = client_under_pointer()) &&
             (allow_refocus || c != old) &&
             (client_normal(c) &&
@@ -153,7 +155,7 @@ static ObClient* focus_fallback_target(gboolean allow_refocus, ObClient *old)
     return NULL;
 }
 
-ObClient* focus_fallback(gboolean allow_refocus)
+ObClient* focus_fallback(gboolean allow_refocus, gboolean allow_pointer)
 {
     ObClient *new;
     ObClient *old = focus_client;
@@ -163,7 +165,7 @@ ObClient* focus_fallback(gboolean allow_refocus)
        event at all for them. */
     focus_nothing();
 
-    new = focus_fallback_target(allow_refocus, old);
+    new = focus_fallback_target(allow_refocus, allow_pointer, old);
 
     return new;
 }
index 9bd4f206e90a900611191b01fbcad2ec06a45358..be7a042d16ee5171562e82fab0744e03899e6531 100644 (file)
@@ -44,7 +44,8 @@ void focus_set_client(struct _ObClient *client);
 void focus_nothing();
 
 /*! Call this when you need to focus something! */
-struct _ObClient* focus_fallback(gboolean allow_refocus);
+struct _ObClient* focus_fallback(gboolean allow_refocus,
+                                 gboolean allow_pointer);
 
 /*! Add a new client into the focus order */
 void focus_order_add_new(struct _ObClient *c);
index deaf55ee20dee5910d38a1a2a55f1831dd16f54d..11d527ee7c4fd43c9cee8c9984155d52d346473e 100644 (file)
@@ -539,12 +539,14 @@ void screen_set_desktop(guint num, gboolean dofocus)
         dofocus = FALSE;
 
     /* have to try focus here because when you leave an empty desktop
-       there is no focus out to watch for
+       there is no focus out to watch for. also, we have different rules
+       here. we always allow it to look under the mouse pointer if
+       config_focus_last is FALSE
 
        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)))
+    if (dofocus && (c = focus_fallback(TRUE, !config_focus_last)))
     {
         /* only do the flicker reducing stuff ahead of time if we are going
            to call xsetinputfocus on the window ourselves. otherwise there is
@@ -1007,7 +1009,7 @@ void screen_show_desktop(gboolean show, ObClient *show_only)
     else if (!show_only) {
         ObClient *c;
 
-        if ((c = focus_fallback(TRUE))) {
+        if ((c = focus_fallback(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.036272 seconds and 4 git commands to generate.