all repos — openbox @ 65d50861ada11f5409680de285f461f16e78c090

openbox fork - make it a bit more like ryudo

when un-showing the desktop if a window is getting shown, iconify the others so just the one is shown
Dana Jansens danakj@orodu.net
commit

65d50861ada11f5409680de285f461f16e78c090

parent

3537e50141f7bd38012e08b68b43d76a146e83dc

M openbox/action.copenbox/action.c

@@ -1245,7 +1245,7 @@

void action_iconify(union ActionData *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); }

@@ -1906,17 +1906,17 @@ }

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) { - screen_show_desktop(TRUE, TRUE); + screen_show_desktop(TRUE, NULL); } void action_unshow_desktop(union ActionData *data) { - screen_show_desktop(FALSE, TRUE); + screen_show_desktop(FALSE, NULL); } void action_break_chroot(union ActionData *data)
M openbox/client.copenbox/client.c

@@ -1694,7 +1694,7 @@ if (self->frame) client_shade(self, FALSE);

else self->shaded = FALSE; } 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; } if (!(self->functions & OB_CLIENT_FUNC_FULLSCREEN) && self->fullscreen) {

@@ -2432,7 +2432,7 @@ /* these are in a carefully crafted order.. */

if (self->iconic) { self->iconic = FALSE; - client_iconify(self, TRUE, FALSE); + client_iconify(self, TRUE, FALSE, TRUE); } if (self->fullscreen) { self->fullscreen = FALSE;

@@ -2807,7 +2807,8 @@ client_focus(self);

} static void client_iconify_recursive(ObClient *self, - gboolean iconic, gboolean curdesk) + gboolean iconic, gboolean curdesk, + gboolean hide_animation) { GSList *it; gboolean changed = FALSE;

@@ -2847,7 +2848,7 @@ }

if (changed) { 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); /* do this after starting the animation so it doesn't flash */ client_showhide(self);

@@ -2858,15 +2859,17 @@ (non-direct too) */

for (it = self->transients; it; it = g_slist_next(it)) if (it->data != self) 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) { /* move up the transient chain as far as possible first */ 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 @@ if (state == self->wmstate) return; /* no change */

switch (state) { case IconicState: - client_iconify(self, TRUE, TRUE); + client_iconify(self, TRUE, TRUE, FALSE); break; case NormalState: - client_iconify(self, FALSE, TRUE); + client_iconify(self, FALSE, TRUE, FALSE); break; } }

@@ -3267,7 +3270,7 @@ transients needs to change */

stacking_raise(CLIENT_AS_WINDOW(self)); } if (iconic != self->iconic) - client_iconify(self, iconic, FALSE); + client_iconify(self, iconic, FALSE, FALSE); if (demands_attention != self->demands_attention) client_hilite(self, demands_attention);

@@ -3390,9 +3393,9 @@ go moving on us */

event_halt_focus_delay(); if (client_normal(self) && screen_showing_desktop) - screen_show_desktop(FALSE, FALSE); + screen_show_desktop(FALSE, self); if (self->iconic) - client_iconify(self, FALSE, here); + client_iconify(self, FALSE, here, FALSE); if (self->desktop != DESKTOP_ALL && self->desktop != screen_desktop) {
M openbox/client.hopenbox/client.h

@@ -458,7 +458,8 @@ @param curdesk If iconic is FALSE, then this determines if the window will

be uniconified to the current viewable desktop (true) or to 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 @param max true if the window should be maximized; false if it should be
M openbox/client_menu.copenbox/client_menu.c

@@ -114,7 +114,7 @@ /* the client won't be on screen anymore so hide the menu */

menu_frame_hide_all(); f = NULL; /* and don't update */ - client_iconify(c, TRUE, FALSE); + client_iconify(c, TRUE, FALSE, FALSE); break; case CLIENT_RESTORE: client_maximize(c, FALSE, 0);
M openbox/event.copenbox/event.c

@@ -660,7 +660,7 @@ guint d = e->xclient.data.l[0];

if (d > 0) screen_set_num_desktops(d); } 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) { if (e->xclient.data.l[0] == 1) ob_reconfigure();
M openbox/screen.copenbox/screen.c

@@ -906,7 +906,7 @@ screen_desktop_names,

screen_num_desktops); } -void screen_show_desktop(gboolean show, gboolean restore_focus) +void screen_show_desktop(gboolean show, ObClient *show_only) { GList *it;

@@ -915,19 +915,25 @@

screen_showing_desktop = show; if (show) { - /* bottom to top */ + /* hide windows bottom to top */ for (it = g_list_last(stacking_list); it; it = g_list_previous(it)) { if (WINDOW_IS_CLIENT(it->data)) { ObClient *client = it->data; client_showhide(client); } } - } else { - /* top to bottom */ + } + else { + /* restore windows top to bottom */ for (it = stacking_list; it; it = g_list_next(it)) { if (WINDOW_IS_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 @@ (c->desktop == screen_desktop || c->desktop == DESKTOP_ALL) &&

client_focus(it->data)) break; } - } else if (restore_focus) { + } + else if (!show_only) { ObClient *c; /* use NULL for the "old" argument because the desktop was focused
M openbox/screen.hopenbox/screen.h

@@ -75,8 +75,12 @@ /*! Show/hide the desktop popup (pager) for the given desktop */

void screen_desktop_popup(guint d, gboolean show); /*! Shows and focuses the desktop and hides all the client windows, or - returns to the normal state, showing client windows. */ -void screen_show_desktop(gboolean show, gboolean restore_focus); + returns to the normal state, showing client windows. + @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 */ void screen_update_layout();