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);
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);
#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
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;
+ }
}
}