summaryrefslogtreecommitdiff
path: root/openbox/client.c
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-04-07 03:46:41 +0000
committerDana Jansens <danakj@orodu.net>2003-04-07 03:46:41 +0000
commitdb086ef336e01ee23c777f3dc6678568565d44ef (patch)
tree2cc04723f59aff38de8065eb92d1bcab1d33b5f8 /openbox/client.c
parent1f775fdd864715abb622070a9b4dd38341d6da79 (diff)
put focus_cycle into focus.c, use it there in the action. improved it as well to handle odd cases like modal windows. added functions to client.c which are needed by the focus cycling routine.
Diffstat (limited to 'openbox/client.c')
-rw-r--r--openbox/client.c25
1 files changed, 19 insertions, 6 deletions
diff --git a/openbox/client.c b/openbox/client.c
index 36ca352c..1b1fedad 100644
--- a/openbox/client.c
+++ b/openbox/client.c
@@ -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);
}