when un-showing the desktop if a window is getting shown, iconify the others so just the one is shown

This commit is contained in:
Dana Jansens 2007-05-10 23:22:54 +00:00
parent 3537e50141
commit 65d50861ad
7 changed files with 42 additions and 27 deletions

View file

@ -1245,7 +1245,7 @@ void action_unfocus (union ActionData *data)
void action_iconify(union ActionData *data) void action_iconify(union ActionData *data)
{ {
client_action_start(data); client_action_start(data);
client_iconify(data->client.any.c, TRUE, TRUE); client_iconify(data->client.any.c, TRUE, TRUE, FALSE);
client_action_end(data); client_action_end(data);
} }
@ -1906,17 +1906,17 @@ void action_toggle_dockautohide(union ActionData *data)
void action_toggle_show_desktop(union ActionData *data) void action_toggle_show_desktop(union ActionData *data)
{ {
screen_show_desktop(!screen_showing_desktop, TRUE); screen_show_desktop(!screen_showing_desktop, NULL);
} }
void action_show_desktop(union ActionData *data) void action_show_desktop(union ActionData *data)
{ {
screen_show_desktop(TRUE, TRUE); screen_show_desktop(TRUE, NULL);
} }
void action_unshow_desktop(union ActionData *data) void action_unshow_desktop(union ActionData *data)
{ {
screen_show_desktop(FALSE, TRUE); screen_show_desktop(FALSE, NULL);
} }
void action_break_chroot(union ActionData *data) void action_break_chroot(union ActionData *data)

View file

@ -1694,7 +1694,7 @@ static void client_change_allowed_actions(ObClient *self)
else self->shaded = FALSE; else self->shaded = FALSE;
} }
if (!(self->functions & OB_CLIENT_FUNC_ICONIFY) && self->iconic) { if (!(self->functions & OB_CLIENT_FUNC_ICONIFY) && self->iconic) {
if (self->frame) client_iconify(self, FALSE, TRUE); if (self->frame) client_iconify(self, FALSE, TRUE, FALSE);
else self->iconic = FALSE; else self->iconic = FALSE;
} }
if (!(self->functions & OB_CLIENT_FUNC_FULLSCREEN) && self->fullscreen) { if (!(self->functions & OB_CLIENT_FUNC_FULLSCREEN) && self->fullscreen) {
@ -2432,7 +2432,7 @@ static void client_apply_startup_state(ObClient *self, gint x, gint y)
if (self->iconic) { if (self->iconic) {
self->iconic = FALSE; self->iconic = FALSE;
client_iconify(self, TRUE, FALSE); client_iconify(self, TRUE, FALSE, TRUE);
} }
if (self->fullscreen) { if (self->fullscreen) {
self->fullscreen = FALSE; self->fullscreen = FALSE;
@ -2807,7 +2807,8 @@ void client_fullscreen(ObClient *self, gboolean fs)
} }
static void client_iconify_recursive(ObClient *self, static void client_iconify_recursive(ObClient *self,
gboolean iconic, gboolean curdesk) gboolean iconic, gboolean curdesk,
gboolean hide_animation)
{ {
GSList *it; GSList *it;
gboolean changed = FALSE; gboolean changed = FALSE;
@ -2847,7 +2848,7 @@ static void client_iconify_recursive(ObClient *self,
if (changed) { if (changed) {
client_change_state(self); client_change_state(self);
if (ob_state() != OB_STATE_STARTING && config_animate_iconify) if (config_animate_iconify && !hide_animation)
frame_begin_iconify_animation(self->frame, iconic); frame_begin_iconify_animation(self->frame, iconic);
/* do this after starting the animation so it doesn't flash */ /* do this after starting the animation so it doesn't flash */
client_showhide(self); client_showhide(self);
@ -2858,15 +2859,17 @@ static void client_iconify_recursive(ObClient *self,
for (it = self->transients; it; it = g_slist_next(it)) for (it = self->transients; it; it = g_slist_next(it))
if (it->data != self) if (it->data != self)
if (client_is_direct_child(self, it->data) || !iconic) if (client_is_direct_child(self, it->data) || !iconic)
client_iconify_recursive(it->data, iconic, curdesk); client_iconify_recursive(it->data, iconic, curdesk,
hide_animation);
} }
void client_iconify(ObClient *self, gboolean iconic, gboolean curdesk) void client_iconify(ObClient *self, gboolean iconic, gboolean curdesk,
gboolean hide_animation)
{ {
if (self->functions & OB_CLIENT_FUNC_ICONIFY || !iconic) { if (self->functions & OB_CLIENT_FUNC_ICONIFY || !iconic) {
/* move up the transient chain as far as possible first */ /* move up the transient chain as far as possible first */
self = client_search_top_normal_parent(self); self = client_search_top_normal_parent(self);
client_iconify_recursive(self, iconic, curdesk); client_iconify_recursive(self, iconic, curdesk, hide_animation);
} }
} }
@ -3100,10 +3103,10 @@ void client_set_wm_state(ObClient *self, glong state)
switch (state) { switch (state) {
case IconicState: case IconicState:
client_iconify(self, TRUE, TRUE); client_iconify(self, TRUE, TRUE, FALSE);
break; break;
case NormalState: case NormalState:
client_iconify(self, FALSE, TRUE); client_iconify(self, FALSE, TRUE, FALSE);
break; break;
} }
} }
@ -3267,7 +3270,7 @@ void client_set_state(ObClient *self, Atom action, glong data1, glong data2)
stacking_raise(CLIENT_AS_WINDOW(self)); stacking_raise(CLIENT_AS_WINDOW(self));
} }
if (iconic != self->iconic) if (iconic != self->iconic)
client_iconify(self, iconic, FALSE); client_iconify(self, iconic, FALSE, FALSE);
if (demands_attention != self->demands_attention) if (demands_attention != self->demands_attention)
client_hilite(self, demands_attention); client_hilite(self, demands_attention);
@ -3390,9 +3393,9 @@ static void client_present(ObClient *self, gboolean here, gboolean raise)
event_halt_focus_delay(); event_halt_focus_delay();
if (client_normal(self) && screen_showing_desktop) if (client_normal(self) && screen_showing_desktop)
screen_show_desktop(FALSE, FALSE); screen_show_desktop(FALSE, self);
if (self->iconic) if (self->iconic)
client_iconify(self, FALSE, here); client_iconify(self, FALSE, here, FALSE);
if (self->desktop != DESKTOP_ALL && if (self->desktop != DESKTOP_ALL &&
self->desktop != screen_desktop) self->desktop != screen_desktop)
{ {

View file

@ -458,7 +458,8 @@ void client_fullscreen(ObClient *self, gboolean fs);
be uniconified to the current viewable desktop (true) or to be uniconified to the current viewable desktop (true) or to
its previous desktop (false) its previous desktop (false)
*/ */
void client_iconify(ObClient *self, gboolean iconic, gboolean curdesk); void client_iconify(ObClient *self, gboolean iconic, gboolean curdesk,
gboolean hide_animation);
/*! Maximize or unmaximize the client window /*! Maximize or unmaximize the client window
@param max true if the window should be maximized; false if it should be @param max true if the window should be maximized; false if it should be

View file

@ -114,7 +114,7 @@ static void client_menu_execute(ObMenuEntry *e, ObMenuFrame *f,
menu_frame_hide_all(); menu_frame_hide_all();
f = NULL; /* and don't update */ f = NULL; /* and don't update */
client_iconify(c, TRUE, FALSE); client_iconify(c, TRUE, FALSE, FALSE);
break; break;
case CLIENT_RESTORE: case CLIENT_RESTORE:
client_maximize(c, FALSE, 0); client_maximize(c, FALSE, 0);

View file

@ -660,7 +660,7 @@ static void event_handle_root(XEvent *e)
if (d > 0) if (d > 0)
screen_set_num_desktops(d); screen_set_num_desktops(d);
} else if (msgtype == prop_atoms.net_showing_desktop) { } else if (msgtype == prop_atoms.net_showing_desktop) {
screen_show_desktop(e->xclient.data.l[0] != 0, TRUE); screen_show_desktop(e->xclient.data.l[0] != 0, NULL);
} else if (msgtype == prop_atoms.openbox_control) { } else if (msgtype == prop_atoms.openbox_control) {
if (e->xclient.data.l[0] == 1) if (e->xclient.data.l[0] == 1)
ob_reconfigure(); ob_reconfigure();

View file

@ -906,7 +906,7 @@ void screen_update_desktop_names()
screen_num_desktops); screen_num_desktops);
} }
void screen_show_desktop(gboolean show, gboolean restore_focus) void screen_show_desktop(gboolean show, ObClient *show_only)
{ {
GList *it; GList *it;
@ -915,19 +915,25 @@ void screen_show_desktop(gboolean show, gboolean restore_focus)
screen_showing_desktop = show; screen_showing_desktop = show;
if (show) { if (show) {
/* bottom to top */ /* hide windows bottom to top */
for (it = g_list_last(stacking_list); it; it = g_list_previous(it)) { for (it = g_list_last(stacking_list); it; it = g_list_previous(it)) {
if (WINDOW_IS_CLIENT(it->data)) { if (WINDOW_IS_CLIENT(it->data)) {
ObClient *client = it->data; ObClient *client = it->data;
client_showhide(client); client_showhide(client);
} }
} }
} else { }
/* top to bottom */ else {
/* restore windows top to bottom */
for (it = stacking_list; it; it = g_list_next(it)) { for (it = stacking_list; it; it = g_list_next(it)) {
if (WINDOW_IS_CLIENT(it->data)) { if (WINDOW_IS_CLIENT(it->data)) {
ObClient *client = it->data; ObClient *client = it->data;
client_showhide(client); if (client_should_show(client)) {
if (!show_only || client == show_only)
client_show(client);
else
client_iconify(client, TRUE, FALSE, TRUE);
}
} }
} }
} }
@ -941,7 +947,8 @@ void screen_show_desktop(gboolean show, gboolean restore_focus)
client_focus(it->data)) client_focus(it->data))
break; break;
} }
} else if (restore_focus) { }
else if (!show_only) {
ObClient *c; ObClient *c;
/* use NULL for the "old" argument because the desktop was focused /* use NULL for the "old" argument because the desktop was focused

View file

@ -75,8 +75,12 @@ guint screen_cycle_desktop(ObDirection dir, gboolean wrap, gboolean linear,
void screen_desktop_popup(guint d, gboolean show); void screen_desktop_popup(guint d, gboolean show);
/*! Shows and focuses the desktop and hides all the client windows, or /*! Shows and focuses the desktop and hides all the client windows, or
returns to the normal state, showing client windows. */ returns to the normal state, showing client windows.
void screen_show_desktop(gboolean show, gboolean restore_focus); @param If show_only is non-NULL, then only that client is shown (assuming
show is FALSE (restoring from show-desktop mode), and the rest are
iconified.
*/
void screen_show_desktop(gboolean show, struct _ObClient *show_only);
/*! Updates the desktop layout from the root property if available */ /*! Updates the desktop layout from the root property if available */
void screen_update_layout(); void screen_update_layout();