]> Dogcows Code - chaz/openbox/commitdiff
when you focus a window, bring any modal children it has to that desktop
authorDana Jansens <danakj@orodu.net>
Mon, 28 May 2007 00:33:58 +0000 (00:33 +0000)
committerDana Jansens <danakj@orodu.net>
Mon, 28 May 2007 00:33:58 +0000 (00:33 +0000)
when falling back, return the window which actually was focused by client_focus
let you focus cycle to windows when their modal window is on another desktop (it will be brought over)

openbox/client.c
openbox/client.h
openbox/focus.c
openbox/focus_cycle.c

index dbbba7de3b0fdd299e583b93d7ea3f86edc4508f..477575a8cf9817717e33bd8ca395d5103c35a5f6 100644 (file)
@@ -3463,6 +3463,8 @@ gboolean client_can_focus(ObClient *self)
 
 gboolean client_focus(ObClient *self)
 {
+    client_bring_modal_windows(self);
+
     /* choose the correct target */
     self = client_focus_target(self);
 
@@ -3582,15 +3584,18 @@ void client_activate(ObClient *self, gboolean here, gboolean user)
         client_hilite(self, TRUE);
 }
 
-static void client_bring_helper_windows_recursive(ObClient *self,
-                                                  guint desktop)
+static void client_bring_windows_recursive(ObClient *self,
+                                           guint desktop,
+                                           gboolean helpers,
+                                           gboolean modals)
 {
     GSList *it;
 
     for (it = self->transients; it; it = g_slist_next(it))
-        client_bring_helper_windows_recursive(it->data, desktop);
+        client_bring_windows_recursive(it->data, desktop, helpers, modals);
 
-    if (client_helper(self) &&
+    if (((helpers && client_helper(self)) ||
+         (modals && self->modal))&&
         self->desktop != desktop && self->desktop != DESKTOP_ALL)
     {
         client_set_desktop(self, desktop, FALSE);
@@ -3599,7 +3604,12 @@ static void client_bring_helper_windows_recursive(ObClient *self,
 
 void client_bring_helper_windows(ObClient *self)
 {
-    client_bring_helper_windows_recursive(self, self->desktop);
+    client_bring_windows_recursive(self, self->desktop, TRUE, FALSE);
+}
+
+void client_bring_modal_windows(ObClient *self)
+{
+    client_bring_windows_recursive(self, self->desktop, FALSE, TRUE);
 }
 
 gboolean client_focused(ObClient *self)
index 755b973ac9540700bf8cdeac203c7c9df0ae64de..3d81b270cc2130f3c6279a02934cf9a1ca8a6e7a 100644 (file)
@@ -562,6 +562,9 @@ void client_activate(ObClient *self, gboolean here, gboolean user);
   stuff windows. */
 void client_bring_helper_windows(ObClient *self);
 
+/*! Bring all of its modal windows to its desktop. */
+void client_bring_modal_windows(ObClient *self);
+
 /*! Calculates the stacking layer for the client window */
 void client_calc_layer(ObClient *self);
 
index 59dd0d0d4f8eccbb230cdeb9ff53781e36493fe5..87f589f2d055cc24eeb2dc400662e24e20beb7c5 100644 (file)
@@ -166,6 +166,8 @@ ObClient* focus_fallback(gboolean allow_refocus, gboolean allow_pointer)
     focus_nothing();
 
     new = focus_fallback_target(allow_refocus, allow_pointer, old);
+    /* get what was really focused */
+    if (new) new = client_focus_target(new);
 
     return new;
 }
index 46f5f058daff1bf5424973dec9693807ff5708e2..74cabac6fc65006b6eade9422ebcc5600baa4b30 100644 (file)
@@ -150,7 +150,11 @@ gboolean focus_cycle_target_valid(ObClient *ft,
                 !ft->skip_taskbar);
 
     /* it's not going to just send fous off somewhere else (modal window) */
-    ok = ok && ft == client_focus_target(ft);
+    {
+        ObClient *cft = client_focus_target(ft);
+        ok = ok && (ft == cft || (cft->desktop != DESKTOP_ALL &&
+                                  cft->desktop != ft->desktop));
+    }
 
     return ok;
 }
This page took 0.038073 seconds and 4 git commands to generate.