GList *client_list = NULL;
static GSList *client_destroy_notifies = NULL;
-static GSList *client_hide_notifies = NULL;
static void client_get_all(ObClient *self, gboolean real);
static void client_toggle_border(ObClient *self, gboolean show);
}
}
-void client_add_hide_notify(ObClientCallback func, gpointer data)
-{
- ClientCallback *d = g_new(ClientCallback, 1);
- d->func = func;
- d->data = data;
- client_hide_notifies = g_slist_prepend(client_hide_notifies, d);
-}
-
-void client_remove_hide_notify(ObClientCallback func)
-{
- GSList *it;
-
- for (it = client_hide_notifies; it; it = g_slist_next(it)) {
- ClientCallback *d = it->data;
- if (d->func == func) {
- g_free(d);
- client_hide_notifies =
- g_slist_delete_link(client_hide_notifies, it);
- break;
- }
- }
-}
-
void client_set_list()
{
Window *windows, *win_it;
self->frame->size.bottom == 0 && self->frame->size.top == 0 &&
RECT_EQUAL(self->area,
*screen_physical_area_monitor
- (client_monitor(self))))))) {
- if (client_focused(self) || client_search_focus_tree(self))
- l = OB_STACKING_LAYER_FULLSCREEN;
- else
- l = OB_STACKING_LAYER_FULLSCREEN_BELOW;
- }
+ (client_monitor(self)))))) &&
+ (client_focused(self) || client_search_focus_tree(self)))
+ l = OB_STACKING_LAYER_FULLSCREEN;
else if (self->above) l = OB_STACKING_LAYER_ABOVE;
else if (self->below) l = OB_STACKING_LAYER_BELOW;
else l = OB_STACKING_LAYER_NORMAL;
void client_hide(ObClient *self)
{
- if (!client_should_show(self)) {
+ if (!client_should_show(self))
frame_hide(self->frame);
- client_call_notifies(self, client_hide_notifies);
- }
-
/* According to the ICCCM (sec 4.1.3.1) when a window is not visible, it
needs to be in IconicState. This includes when it is on another
desktop!
void client_showhide(ObClient *self)
{
- if (client_should_show(self)) {
+ if (client_should_show(self))
frame_show(self->frame);
- }
- else {
+ else
frame_hide(self->frame);
- client_call_notifies(self, client_hide_notifies);
- }
-
/* According to the ICCCM (sec 4.1.3.1) when a window is not visible, it
needs to be in IconicState. This includes when it is on another
desktop!
gboolean client_focus(ObClient *self)
{
+ gboolean error;
+
/* choose the correct target */
self = client_focus_target(self);
if (keyboard_interactively_grabbed())
keyboard_interactive_cancel();
+ error = FALSE;
+ xerror_set_ignore(TRUE);
+
if (self->can_focus) {
/* This can cause a BadMatch error with CurrentTime, or if an app
passed in a bad time for _NET_WM_ACTIVE_WINDOW. */
- xerror_set_ignore(TRUE);
XSetInputFocus(ob_display, self->window, RevertToPointerRoot,
event_curtime);
- xerror_set_ignore(FALSE);
}
if (self->focus_notify) {
XSendEvent(ob_display, self->window, FALSE, NoEventMask, &ce);
}
-#ifdef DEBUG_FOCUS
- ob_debug("%sively focusing %lx at %d\n",
- (self->can_focus ? "act" : "pass"),
- self->window, (gint) event_curtime);
-#endif
+ /* This calls XSync, which will cause the FocusIn to come back to us.
+ That's important for desktop switches, since otherwise we'll have no
+ FocusIn on the queue and end up falling back again. */
+ xerror_set_ignore(FALSE);
+ if (!xerror_occured) error = TRUE;
- /* Cause the FocusIn to come back to us. Important for desktop switches,
- since otherwise we'll have no FocusIn on the queue and send it off to
- the focus_backup. */
- XSync(ob_display, FALSE);
- return TRUE;
+ return !error;
}
/*! Present the client to the user.