don't validate inside client_focus. instead, validate before you call it!

This commit is contained in:
Dana Jansens 2007-03-12 06:04:00 +00:00
parent 6b7cc88c9d
commit 85a1a0cfb3
5 changed files with 14 additions and 7 deletions

View file

@ -1164,7 +1164,8 @@ void action_focus(union ActionData *data)
moving on us */ moving on us */
event_halt_focus_delay(); event_halt_focus_delay();
client_focus(data->client.any.c); if (client_validate(data->client.any.c))
client_focus(data->client.any.c);
} }
} }

View file

@ -2937,8 +2937,10 @@ gboolean client_focus(ObClient *self)
/* choose the correct target */ /* choose the correct target */
self = client_focus_target(self); self = client_focus_target(self);
#if 0
if (!client_validate(self)) if (!client_validate(self))
return FALSE; return FALSE;
#endif
if (!client_can_focus(self)) { if (!client_can_focus(self)) {
if (!self->frame->visible) { if (!self->frame->visible) {

View file

@ -472,7 +472,9 @@ ObClient *client_focus_target(ObClient *self);
without focusing it or modifying the focus order lists. */ without focusing it or modifying the focus order lists. */
gboolean client_can_focus(ObClient *self); gboolean client_can_focus(ObClient *self);
/*! Attempt to focus the client window */ /*! Attempt to focus the client window
NOTE: You should validate the client before calling this !! (client_validate)
*/
gboolean client_focus(ObClient *self); gboolean client_focus(ObClient *self);
/*! Remove focus from the client window */ /*! Remove focus from the client window */

View file

@ -433,7 +433,7 @@ static void event_process(const XEvent *ec, gpointer data)
} }
} }
#if 0 /* focus debugging stuff */ #if 1 /* focus debugging stuff */
if (e->type == FocusIn || e->type == FocusOut) { if (e->type == FocusIn || e->type == FocusOut) {
gint mode = e->xfocus.mode; gint mode = e->xfocus.mode;
gint detail = e->xfocus.detail; gint detail = e->xfocus.detail;
@ -1287,9 +1287,11 @@ static gboolean focus_delay_func(gpointer data)
ObClient *c = data; ObClient *c = data;
if (focus_client != c) { if (focus_client != c) {
client_focus(c); if (client_validate(c)) {
if (config_focus_raise) client_focus(c);
client_raise(c); if (config_focus_raise)
client_raise(c);
}
} }
return FALSE; /* no repeat */ return FALSE; /* no repeat */
} }

View file

@ -894,7 +894,7 @@ void screen_show_desktop(gboolean show)
/* focus desktop */ /* focus desktop */
for (it = focus_order[screen_desktop]; it; it = g_list_next(it)) for (it = focus_order[screen_desktop]; it; it = g_list_next(it))
if (((ObClient*)it->data)->type == OB_CLIENT_TYPE_DESKTOP && if (((ObClient*)it->data)->type == OB_CLIENT_TYPE_DESKTOP &&
client_focus(it->data)) client_validate(it->data) && client_focus(it->data))
break; break;
} else { } else {
focus_fallback(OB_FOCUS_FALLBACK_NOFOCUS); focus_fallback(OB_FOCUS_FALLBACK_NOFOCUS);