use client_can_focus from client_focus to always get the same result

This commit is contained in:
Dana Jansens 2003-06-04 19:24:37 +00:00
parent 4cb48bebb5
commit c6fd3aa890

View file

@ -2241,7 +2241,7 @@ Client *client_focus_target(Client *self)
gboolean client_can_focus(Client *self) gboolean client_can_focus(Client *self)
{ {
/* same code as in client_focus */ XEvent ev;
/* choose the correct target */ /* choose the correct target */
self = client_focus_target(self); self = client_focus_target(self);
@ -2249,30 +2249,6 @@ gboolean client_can_focus(Client *self)
if (!self->frame->visible) if (!self->frame->visible)
return FALSE; 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);
if (!self->frame->visible) {
/* update the focus lists */
focus_order_to_top(self);
return FALSE;
}
if (!((self->can_focus || self->focus_notify) && if (!((self->can_focus || self->focus_notify) &&
(self->desktop == screen_desktop || (self->desktop == screen_desktop ||
self->desktop == DESKTOP_ALL) && self->desktop == DESKTOP_ALL) &&
@ -2297,6 +2273,22 @@ gboolean client_focus(Client *self)
} }
} }
return TRUE;
}
gboolean client_focus(Client *self)
{
/* choose the correct target */
self = client_focus_target(self);
if (!client_can_focus(self)) {
if (!self->frame->visible) {
/* update the focus lists */
focus_order_to_top(self);
}
return FALSE;
}
if (self->can_focus) if (self->can_focus)
/* RevertToPointerRoot causes much more headache than RevertToNone, so /* RevertToPointerRoot causes much more headache than RevertToNone, so
I choose to use it always, hopefully to find errors quicker, if any I choose to use it always, hopefully to find errors quicker, if any