summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDana Jansens <danakj@orodu.net>2003-04-17 18:21:19 +0000
committerDana Jansens <danakj@orodu.net>2003-04-17 18:21:19 +0000
commitcfe3dc9ec4d582cf71df06d45e6045b3e32464af (patch)
tree4751307172a19a6a1dff9a2378c0ade7d23ad678
parent322b2d0a05daf0c0c9de07baf5e27e4945f7bfd5 (diff)
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
-rw-r--r--openbox/client.c45
1 files changed, 40 insertions, 5 deletions
diff --git a/openbox/client.c b/openbox/client.c
index 17172dd9..4d3010dc 100644
--- a/openbox/client.c
+++ b/openbox/client.c
@@ -492,11 +492,12 @@ static void client_get_all(Client *self)
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 @@ static void client_get_all(Client *self)
(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 @@ static void client_get_desktop(Client *self)
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,10 +2105,26 @@ gboolean client_focusable(Client *self)
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;