X-Git-Url: https://git.brokenzipper.com/gitweb?a=blobdiff_plain;f=openbox%2Fclient.c;h=1b1fedad7b944e63270abdc3203026aec7a5149c;hb=db086ef336e01ee23c777f3dc6678568565d44ef;hp=dbeb658b0826d896c4e4ea6f2cb7e2e71f47ee8c;hpb=3d0ba381dba5a421e8bb91e29f08412048a8427c;p=chaz%2Fopenbox diff --git a/openbox/client.c b/openbox/client.c index dbeb658b..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,7 +1996,8 @@ gboolean client_focus(Client *self) void client_unfocus(Client *self) { g_assert(focus_client == self); - focus_fallbacK(FALSE); + g_message("client_unfocus"); + focus_fallback(FALSE); } gboolean client_focused(Client *self)