From 99c6a00cf6cae461f45d8fd3e852a9479f3694bc Mon Sep 17 00:00:00 2001 From: Dana Jansens Date: Wed, 13 Jun 2007 15:13:16 +0000 Subject: [PATCH] don't raise windows when moving them between desktops in some cases --- openbox/action.c | 10 +++++----- openbox/client.c | 19 +++++++++++-------- openbox/client.h | 5 ++++- openbox/client_menu.c | 2 +- openbox/event.c | 2 +- openbox/screen.c | 4 ++-- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/openbox/action.c b/openbox/action.c index 52b1de3d..da4eee75 100644 --- a/openbox/action.c +++ b/openbox/action.c @@ -1437,7 +1437,7 @@ void action_toggle_omnipresent(union ActionData *data) { client_set_desktop(data->client.any.c, data->client.any.c->desktop == DESKTOP_ALL ? - screen_desktop : DESKTOP_ALL, FALSE); + screen_desktop : DESKTOP_ALL, FALSE, TRUE); } void action_move_relative_horz(union ActionData *data) @@ -1611,7 +1611,7 @@ void action_send_to_desktop(union ActionData *data) if (data->sendto.desk < screen_num_desktops || data->sendto.desk == DESKTOP_ALL) { - client_set_desktop(c, data->sendto.desk, data->sendto.follow); + client_set_desktop(c, data->sendto.desk, data->sendto.follow, FALSE); if (data->sendto.follow && data->sendto.desk != screen_desktop) screen_set_desktop(data->sendto.desk, TRUE); } @@ -1669,7 +1669,7 @@ void action_send_to_desktop_dir(union ActionData *data) if (!data->sendtodir.inter.any.interactive || (data->sendtodir.inter.final && !data->sendtodir.inter.cancel)) { - client_set_desktop(c, d, data->sendtodir.follow); + client_set_desktop(c, d, data->sendtodir.follow, FALSE); if (data->sendtodir.follow && d != screen_desktop) screen_set_desktop(d, TRUE); } @@ -2045,7 +2045,7 @@ void action_add_desktop(union ActionData *data) for (it = client_list; it; it = g_list_next(it)) { ObClient *c = it->data; if (c->desktop != DESKTOP_ALL && c->desktop >= screen_desktop) - client_set_desktop(c, c->desktop+1, FALSE); + client_set_desktop(c, c->desktop+1, FALSE, TRUE); } } } @@ -2061,7 +2061,7 @@ void action_remove_desktop(union ActionData *data) for (it = client_list; it; it = g_list_next(it)) { ObClient *c = it->data; if (c->desktop != DESKTOP_ALL && c->desktop > screen_desktop) - client_set_desktop(c, c->desktop-1, FALSE); + client_set_desktop(c, c->desktop-1, FALSE, TRUE); } } diff --git a/openbox/client.c b/openbox/client.c index 563eb045..d80ed298 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -3071,7 +3071,7 @@ static void client_iconify_recursive(ObClient *self, if (curdesk && self->desktop != screen_desktop && self->desktop != DESKTOP_ALL) - client_set_desktop(self, screen_desktop, FALSE); + client_set_desktop(self, screen_desktop, FALSE, FALSE); /* this puts it after the current focused window */ focus_order_remove(self); @@ -3244,7 +3244,8 @@ void client_hilite(ObClient *self, gboolean hilite) void client_set_desktop_recursive(ObClient *self, guint target, - gboolean donthide) + gboolean donthide, + gboolean dontraise) { guint old; GSList *it; @@ -3264,7 +3265,7 @@ void client_set_desktop_recursive(ObClient *self, if (!donthide) client_showhide(self); /* raise if it was not already on the desktop */ - if (old != DESKTOP_ALL) + if (old != DESKTOP_ALL && !dontraise) stacking_raise(CLIENT_AS_WINDOW(self)); if (STRUT_EXISTS(self->strut)) screen_update_areas(); @@ -3278,13 +3279,15 @@ void client_set_desktop_recursive(ObClient *self, for (it = self->transients; it; it = g_slist_next(it)) if (it->data != self) if (client_is_direct_child(self, it->data)) - client_set_desktop_recursive(it->data, target, donthide); + client_set_desktop_recursive(it->data, target, + donthide, dontraise); } -void client_set_desktop(ObClient *self, guint target, gboolean donthide) +void client_set_desktop(ObClient *self, guint target, + gboolean donthide, gboolean dontraise) { self = client_search_top_direct_parent(self); - client_set_desktop_recursive(self, target, donthide); + client_set_desktop_recursive(self, target, donthide, dontraise); } gboolean client_is_direct_child(ObClient *parent, ObClient *child) @@ -3616,7 +3619,7 @@ static void client_present(ObClient *self, gboolean here, gboolean raise) self->desktop != screen_desktop) { if (here) - client_set_desktop(self, screen_desktop, FALSE); + client_set_desktop(self, screen_desktop, FALSE, TRUE); else screen_set_desktop(self->desktop, FALSE); } else if (!self->frame->visible) @@ -3683,7 +3686,7 @@ static void client_bring_windows_recursive(ObClient *self, if (iconic && self->iconic) client_iconify(self, FALSE, TRUE, FALSE); else - client_set_desktop(self, desktop, FALSE); + client_set_desktop(self, desktop, FALSE, FALSE); } } diff --git a/openbox/client.h b/openbox/client.h index a334ad2b..812d0ac5 100644 --- a/openbox/client.h +++ b/openbox/client.h @@ -496,8 +496,11 @@ void client_kill(ObClient *self); /*! Sends the window to the specified desktop @param donthide If TRUE, the window will not be shown/hidden after its desktop has been changed. Generally this should be FALSE. + @param dontraise If TRUE, the window will not be raised. Generally this should + be FALSE. */ -void client_set_desktop(ObClient *self, guint target, gboolean donthide); +void client_set_desktop(ObClient *self, guint target, gboolean donthide, + gboolean dontraise); /*! Show the client if it should be shown. Returns if the window is shown. */ gboolean client_show(ObClient *self); diff --git a/openbox/client_menu.c b/openbox/client_menu.c index ce29db10..cc67a461 100644 --- a/openbox/client_menu.c +++ b/openbox/client_menu.c @@ -286,7 +286,7 @@ static void send_to_menu_execute(ObMenuEntry *e, ObMenuFrame *f, { g_assert(c); - client_set_desktop(c, e->id, FALSE); + client_set_desktop(c, e->id, FALSE, FALSE); /* the client won't even be on the screen anymore, so hide the menu */ if (f) menu_frame_hide_all(); diff --git a/openbox/event.c b/openbox/event.c index cfa000d0..3052e1bf 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1264,7 +1264,7 @@ static void event_handle_client(ObClient *client, XEvent *e) if ((unsigned)e->xclient.data.l[0] < screen_num_desktops || (unsigned)e->xclient.data.l[0] == DESKTOP_ALL) client_set_desktop(client, (unsigned)e->xclient.data.l[0], - FALSE); + FALSE, FALSE); } else if (msgtype == prop_atoms.net_wm_state) { gulong ignore_start; diff --git a/openbox/screen.c b/openbox/screen.c index 92d4d9a4..3d3d73cd 100644 --- a/openbox/screen.c +++ b/openbox/screen.c @@ -520,7 +520,7 @@ void screen_set_num_desktops(guint num) for (it = client_list; it; it = g_list_next(it)) { ObClient *c = it->data; if (c->desktop >= num && c->desktop != DESKTOP_ALL) - client_set_desktop(c, num - 1, FALSE); + client_set_desktop(c, num - 1, FALSE, TRUE); } /* change our struts/area to match (after moving windows) */ @@ -561,7 +561,7 @@ void screen_set_desktop(guint num, gboolean dofocus) ignore_start = event_start_ignore_all_enters(); if (moveresize_client) - client_set_desktop(moveresize_client, num, TRUE); + client_set_desktop(moveresize_client, num, TRUE, FALSE); /* show windows before hiding the rest to lessen the enter/leave events */ -- 2.45.2