]> Dogcows Code - chaz/openbox/commitdiff
allow new windows on other desktops to get focused if specified in a per-app rule
authorDana Jansens <danakj@orodu.net>
Fri, 21 May 2010 20:51:45 +0000 (16:51 -0400)
committerDana Jansens <danakj@orodu.net>
Fri, 21 May 2010 20:56:09 +0000 (16:56 -0400)
you can not client_active() with user=false and desktop=true and activate things on other desktops, by the general focus steal restrictions, if you wanted to do that sorta thing

openbox/client.c

index ca1149044bb70b1c473345156d26f99935abe3e7..a71413731dbc935412388d28006fa809a33897cd 100644 (file)
@@ -108,8 +108,9 @@ static GSList *client_search_all_top_parents_internal(ObClient *self,
 static void client_call_notifies(ObClient *self, GSList *list);
 static void client_ping_event(ObClient *self, gboolean dead);
 static void client_prompt_kill(ObClient *self);
-static gboolean client_can_steal_focus(ObClient *self, Time steal_time,
-                                       Time launch_time);
+static gboolean client_can_steal_focus(ObClient *self,
+                                       gboolean allow_other_desktop,
+                                       Time steal_time, Time launch_time);
 
 void client_startup(gboolean reconfig)
 {
@@ -440,7 +441,8 @@ void client_manage(Window window, ObPrompt *prompt)
     ob_debug_type(OB_DEBUG_FOCUS, "Going to try activate new window? %s",
                   activate ? "yes" : "no");
     if (activate) {
-        activate = client_can_steal_focus(self, event_time(), launch_time);
+        activate = client_can_steal_focus(self, (settings && settings->focus),
+                                          event_time(), launch_time);
 
         if (!activate) {
             /* if the client isn't stealing focus, then hilite it so the user
@@ -698,7 +700,9 @@ void client_fake_unmanage(ObClient *self)
     g_slice_free(ObClient, self);
 }
 
-static gboolean client_can_steal_focus(ObClient *self, Time steal_time,
+static gboolean client_can_steal_focus(ObClient *self,
+                                       gboolean allow_other_desktop,
+                                       Time steal_time,
                                        Time launch_time)
 {
     gboolean steal;
@@ -720,11 +724,13 @@ static gboolean client_can_steal_focus(ObClient *self, Time steal_time,
                   self->window, steal_time, launch_time,
                   event_last_user_time);
 
-    /* if it's on another desktop */
+    /* if it's on another desktop... */
     if (!(self->desktop == screen_desktop ||
           self->desktop == DESKTOP_ALL) &&
-        /* the timestamp is from before you changed desktops */
-        (!launch_time ||
+        /* and (we dont know when it launched, and we don't want to allow
+           focus stealing from other desktops */
+        ((!launch_time && !allow_other_desktop) ||
+         /* or the timestamp is from before you changed desktops) */
          (screen_desktop_user_time &&
           !event_time_after(launch_time, screen_desktop_user_time))))
     {
@@ -3948,7 +3954,7 @@ void client_activate(ObClient *self, gboolean desktop,
     if ((user && (desktop ||
                   self->desktop == DESKTOP_ALL ||
                   self->desktop == screen_desktop)) ||
-        client_can_steal_focus(self, event_time(), CurrentTime))
+        client_can_steal_focus(self, desktop, event_time(), CurrentTime))
     {
         client_present(self, here, raise, unshade);
     }
This page took 0.026957 seconds and 4 git commands to generate.