all repos — openbox @ c03c08415f01a52584158aa4f0356f3a0d7a46aa

openbox fork - make it a bit more like ryudo

don't fallback when a window is hidden right away, it's redundant, we'll get a focusout for the window after the unmapnotify anyways.

show new windows when switching desktops before hiding the old windows.
Dana Jansens danakj@orodu.net
commit

c03c08415f01a52584158aa4f0356f3a0d7a46aa

parent

7059cde13b2da3eb3ec07b48fd643de76425fb21

3 files changed, 41 insertions(+), 11 deletions(-)

jump to
M openbox/client.copenbox/client.c

@@ -455,7 +455,7 @@

/* this has to happen before we try focus the window, but we want it to happen after the client's stacking has been determined or it looks bad */ - client_showhide(self); + client_show(self); /* use client_focus instead of client_activate cuz client_activate does stuff like switch desktops etc and I'm not interested in all that when

@@ -2058,6 +2058,33 @@

return FALSE; } +void client_show(ObClient *self) +{ + + if (client_should_show(self)) { + frame_show(self->frame); + } + + /* 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 + desktop! + */ + client_change_wm_state(self); +} + +void client_hide(ObClient *self) +{ + if (!client_should_show(self)) { + frame_hide(self->frame); + } + + /* 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 + desktop! + */ + client_change_wm_state(self); +} + void client_showhide(ObClient *self) {

@@ -2066,10 +2093,6 @@ frame_show(self->frame);

} else { frame_hide(self->frame); - - /* Fall back focus since we're disappearing */ - if (focus_client == self) - client_unfocus(self); } /* According to the ICCCM (sec 4.1.3.1) when a window is not visible, it
M openbox/client.hopenbox/client.h

@@ -458,6 +458,12 @@ @param donthide If TRUE, the window will not be shown/hidden after its

desktop has been changed. Generally this should be FALSE. */ void client_set_desktop(ObClient *self, guint target, gboolean donthide); +/*! Show the client if it should be shown. */ +void client_show(ObClient *self); + +/*! Show the client if it should be shown. */ +void client_hide(ObClient *self); + /*! Show the client if it should be shown, and hide it if it should be hidden. This is for example, when switching desktops. */
M openbox/screen.copenbox/screen.c

@@ -435,11 +435,11 @@ client_set_desktop(moveresize_client, num, TRUE);

/* show windows before hiding the rest to lessen the enter/leave events */ - /* show windows from top to bottom */ + /* show/hide windows from top to bottom */ for (it = stacking_list; it; it = g_list_next(it)) { if (WINDOW_IS_CLIENT(it->data)) { ObClient *c = it->data; - client_showhide(c); + client_show(c); } }

@@ -447,7 +447,7 @@ /* hide windows from bottom to top */

for (it = g_list_last(stacking_list); it; it = g_list_previous(it)) { if (WINDOW_IS_CLIENT(it->data)) { ObClient *c = it->data; - client_showhide(c); + client_hide(c); } }

@@ -458,9 +458,10 @@ if (focus_hilite) {

frame_adjust_focus(focus_hilite->frame, TRUE); /*! - When this focus_client check is not used, you can end up with races, - as demonstrated with gnome-panel, sometmies the window you click on - another desktop ends up losing focus cuz of the focus change here. + When this focus_client check is not used, you can end up with + races, as demonstrated with gnome-panel, sometimes the window + you click on another desktop ends up losing focus cuz of the + focus change here. */ /*if (!focus_client)*/ client_focus(focus_hilite);