]> Dogcows Code - chaz/openbox/blobdiff - openbox/client.c
put focus_cycle into focus.c, use it there in the action. improved it as well to...
[chaz/openbox] / openbox / client.c
index 36ca352cd8b311c91aa2ad73d1148ba93c1b90ed..1b1fedad7b944e63270abdc3203026aec7a5149c 100644 (file)
@@ -1916,20 +1916,32 @@ void client_set_state(Client *self, Atom action, long data1, long data2)
     client_change_state(self); /* change the hint to relect these changes */
 }
 
-gboolean client_focus(Client *self)
+Client *client_focus_target(Client *self)
 {
-    XEvent ev;
     Client *child;
      
     /* if we have a modal child, then focus it, not us */
     child = client_find_modal_child(self);
-    if (child)
-       return client_focus(child);
+    if (child) return child;
+    return self;
+}
 
+gboolean client_focusable(Client *self)
+{
     /* won't try focus if the client doesn't want it, or if the window isn't
        visible on the screen */
-    if (!(self->frame->visible &&
-         (self->can_focus || self->focus_notify)))
+    return self->frame->visible &&
+        (self->can_focus || self->focus_notify);
+}
+
+gboolean client_focus(Client *self)
+{
+    XEvent ev;
+
+    /* choose the correct target */
+    self = client_focus_target(self);
+
+    if (!client_focusable(self))
        return FALSE;
 
     /* do a check to see if the window has already been unmapped or destroyed
@@ -1984,6 +1996,7 @@ gboolean client_focus(Client *self)
 void client_unfocus(Client *self)
 {
     g_assert(focus_client == self);
+    g_message("client_unfocus");
     focus_fallback(FALSE);
 }
 
This page took 0.023837 seconds and 4 git commands to generate.