big scary g_assert(). interactive actions should never move focus until they're done.

This commit is contained in:
Dana Jansens 2007-05-14 23:21:53 +00:00
parent f9fe78d970
commit f5d7952a94
2 changed files with 22 additions and 19 deletions

View file

@ -2399,11 +2399,13 @@ gboolean client_should_show(ObClient *self)
return FALSE; return FALSE;
} }
void client_show(ObClient *self) gboolean client_show(ObClient *self)
{ {
gboolean show = FALSE;
if (client_should_show(self)) { if (client_should_show(self)) {
frame_show(self->frame); frame_show(self->frame);
show = TRUE;
} }
/* According to the ICCCM (sec 4.1.3.1) when a window is not visible, it /* According to the ICCCM (sec 4.1.3.1) when a window is not visible, it
@ -2411,27 +2413,30 @@ void client_show(ObClient *self)
desktop! desktop!
*/ */
client_change_wm_state(self); client_change_wm_state(self);
return show;
} }
void client_hide(ObClient *self) gboolean client_hide(ObClient *self)
{ {
if (!client_should_show(self)) gboolean hide = FALSE;
if (!client_should_show(self)) {
frame_hide(self->frame); frame_hide(self->frame);
hide = TRUE;
}
/* According to the ICCCM (sec 4.1.3.1) when a window is not visible, it /* 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 needs to be in IconicState. This includes when it is on another
desktop! desktop!
*/ */
client_change_wm_state(self); client_change_wm_state(self);
return hide;
} }
void client_showhide(ObClient *self) void client_showhide(ObClient *self)
{ {
if (!client_show(self))
if (client_should_show(self)) client_hide(self);
frame_show(self->frame);
else
frame_hide(self->frame);
/* According to the ICCCM (sec 4.1.3.1) when a window is not visible, it /* 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 needs to be in IconicState. This includes when it is on another
@ -3338,15 +3343,13 @@ gboolean client_focus(ObClient *self)
"Focusing client \"%s\" at time %u\n", "Focusing client \"%s\" at time %u\n",
self->title, event_curtime); self->title, event_curtime);
/* if there is a grab going on, then we need to cancel it. if we move /* if we move focus during a grab, applications will get
focus during the grab, applications will get NotifyWhileGrabbed events NotifyWhileGrabbed events and ignore them !
and ignore them !
actions should not rely on being able to move focus during an interactive actions should not do anything that can move focus until
interactive grab. their finishing.
*/ */
if (keyboard_interactively_grabbed()) g_assert(keyboard_interactively_grabbed());
keyboard_interactive_cancel();
error = FALSE; error = FALSE;
xerror_set_ignore(TRUE); xerror_set_ignore(TRUE);

View file

@ -493,11 +493,11 @@ void client_kill(ObClient *self);
*/ */
void client_set_desktop(ObClient *self, guint target, gboolean donthide); void client_set_desktop(ObClient *self, guint target, gboolean donthide);
/*! Show the client if it should be shown. */ /*! Show the client if it should be shown. Returns if the window is shown. */
void client_show(ObClient *self); gboolean client_show(ObClient *self);
/*! Show the client if it should be shown. */ /*! Show the client if it should be shown. Returns if the window is hidden. */
void client_hide(ObClient *self); gboolean client_hide(ObClient *self);
/*! Show the client if it should be shown, and hide it if it should be /*! Show the client if it should be shown, and hide it if it should be
hidden. This is for example, when switching desktops. hidden. This is for example, when switching desktops.