all repos — openbox @ cfe3dc9ec4d582cf71df06d45e6045b3e32464af

openbox fork - make it a bit more like ryudo

a) put transient windows on the same desktop as their parent
b) if a window is attempted to be focused but it is not on the current desktop,
   then move it to the top of the focus order on its desktop
Dana Jansens danakj@orodu.net
commit

cfe3dc9ec4d582cf71df06d45e6045b3e32464af

parent

322b2d0a05daf0c0c9de07baf5e27e4945f7bfd5

1 files changed, 40 insertions(+), 5 deletions(-)

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

@@ -492,11 +492,12 @@ self->group = NULL;

self->nicons = 0; client_get_area(self); + client_update_transient_for(self); + client_update_wmhints(self); client_get_desktop(self); client_get_state(self); client_get_shaped(self); - client_update_transient_for(self); client_get_mwm_hints(self); client_get_type(self);/* this can change the mwmhints for special cases */

@@ -510,7 +511,6 @@ /* got the type, the mwmhints, the protocols, and the normal hints

(min/max sizes), so we're ready to set up the decorations/functions */ client_setup_decor_and_functions(self); - client_update_wmhints(self); client_update_title(self); client_update_icon_title(self); client_update_class(self);

@@ -541,9 +541,28 @@ if (PROP_GET32(self->window, net_wm_desktop, cardinal, &d)) {

if (d >= screen_num_desktops && d != DESKTOP_ALL) d = screen_num_desktops - 1; self->desktop = d; - } else { - /* defaults to the current desktop */ - self->desktop = screen_desktop; + } else { + gboolean trdesk = FALSE; + + if (self->transient_for) { + if (self->transient_for != TRAN_GROUP) { + self->desktop = self->transient_for->desktop; + trdesk = TRUE; + } else { + GSList *it; + + for (it = self->group->members; it; it = it->next) + if (it->data != self && + ((Client*)it->data)->transient_for != TRAN_GROUP) { + self->desktop = ((Client*)it->data)->desktop; + trdesk = TRUE; + break; + } + } + } + if (!trdesk) + /* defaults to the current desktop */ + self->desktop = screen_desktop; /* set the desktop hint, to make sure that it always exists */ PROP_SET32(self->window, net_wm_desktop, cardinal, self->desktop);

@@ -2086,9 +2105,25 @@

gboolean client_focus(Client *self) { XEvent ev; + guint i; /* choose the correct target */ self = client_focus_target(self); + + if (self->desktop != DESKTOP_ALL && self->desktop != screen_desktop) { + /* update the focus lists */ + if (self->desktop == DESKTOP_ALL) { + for (i = 0; i < screen_num_desktops; ++i) { + focus_order[i] = g_list_remove(focus_order[i], self); + focus_order[i] = g_list_prepend(focus_order[i], self); + } + } else { + i = self->desktop; + focus_order[i] = g_list_remove(focus_order[i], self); + focus_order[i] = g_list_prepend(focus_order[i], self); + } + return FALSE; + } if (!client_focusable(self)) return FALSE;