all repos — openbox @ e0fa57d21c83bbfe87b15224f699bc24628fd89f

openbox fork - make it a bit more like ryudo

allow focus_fallback to query if a client can be focused without changing the focus order on it
Dana Jansens danakj@orodu.net
commit

e0fa57d21c83bbfe87b15224f699bc24628fd89f

parent

9232682ad64c6ee0956a748312b9ca8136434bf3

3 files changed, 29 insertions(+), 1 deletions(-)

jump to
M openbox/client.copenbox/client.c

@@ -2239,9 +2239,29 @@ if (child) return child;

return self; } +gboolean client_can_focus(Client *self) +{ + /* same code as in client_focus */ + + /* choose the correct target */ + self = client_focus_target(self); + + if (!self->frame->visible) + return FALSE; + + if (!((self->can_focus || self->focus_notify) && + (self->desktop == screen_desktop || + self->desktop == DESKTOP_ALL) && + !self->iconic)) + return FALSE; + return TRUE; +} + gboolean client_focus(Client *self) { XEvent ev; + + /* same code as in client_can_focus */ /* choose the correct target */ self = client_focus_target(self);
M openbox/client.hopenbox/client.h

@@ -430,6 +430,10 @@ you wanted to give focus to the specified Client. Will return the same

Client passed to it or another Client if appropriate. */ Client *client_focus_target(Client *self); +/*! Returns what client_focus would return if passed the same client, but + without focusing it or modifying the focus order lists. */ +gboolean client_can_focus(Client *self); + /*! Attempt to focus the client window */ gboolean client_focus(Client *self);
M openbox/focus.copenbox/focus.c

@@ -15,6 +15,7 @@ #include "popup.h"

#include <X11/Xlib.h> #include <glib.h> +#include <assert.h> Client *focus_client = NULL; GList **focus_order = NULL; /* these lists are created when screen_startup

@@ -213,8 +214,11 @@ for (it = focus_order[screen_desktop]; it != NULL; it = it->next)

for (sit = old->group->members; sit; sit = sit->next) if (sit->data == it->data) if (sit->data != old && client_normal(sit->data)) - if (client_focus(sit->data)) + if (client_can_focus(sit->data)) { + gboolean r = client_focus(sit->data); + assert(r); return; + } } }