From: Dana Jansens Date: Wed, 9 Dec 2009 18:25:19 +0000 (-0500) Subject: Fix the Focus/Activate actions to focus windows on other desktops correctly X-Git-Url: https://git.dogcows.com/gitweb?a=commitdiff_plain;h=324ba15ebc79eb95cf6ec9c0f7d42250fc30f11b;p=chaz%2Fopenbox Fix the Focus/Activate actions to focus windows on other desktops correctly --- diff --git a/openbox/actions/focus.c b/openbox/actions/focus.c index 0ef9d268..8da8ed5e 100644 --- a/openbox/actions/focus.c +++ b/openbox/actions/focus.c @@ -2,6 +2,7 @@ #include "openbox/event.h" #include "openbox/client.h" #include "openbox/focus.h" +#include "openbox/screen.h" typedef struct { gboolean here; @@ -56,7 +57,7 @@ static gboolean run_func(ObActionsData *data, gpointer options) data->context != OB_FRAME_CONTEXT_FRAME)) { actions_client_move(data, TRUE); - client_activate(data->client, o->here, FALSE, FALSE, TRUE); + client_activate(data->client, TRUE, o->here, FALSE, FALSE, TRUE); actions_client_move(data, FALSE); } } else if (data->context == OB_FRAME_CONTEXT_DESKTOP) { diff --git a/openbox/client.c b/openbox/client.c index c4576952..b3f95364 100644 --- a/openbox/client.c +++ b/openbox/client.c @@ -3931,7 +3931,8 @@ static void client_present(ObClient *self, gboolean here, gboolean raise, } /* this function exists to map to the net_active_window message in the ewmh */ -void client_activate(ObClient *self, gboolean desktop, gboolean raise, +void client_activate(ObClient *self, gboolean desktop, + gboolean here, gboolean raise, gboolean unshade, gboolean user) { if ((user && (desktop || @@ -3939,7 +3940,7 @@ void client_activate(ObClient *self, gboolean desktop, gboolean raise, self->desktop == screen_desktop)) || client_can_steal_focus(self, event_curtime, CurrentTime)) { - client_present(self, FALSE, raise, unshade); + client_present(self, here, raise, unshade); } else client_hilite(self, TRUE); diff --git a/openbox/client.h b/openbox/client.h index 15ae2220..3b1e042c 100644 --- a/openbox/client.h +++ b/openbox/client.h @@ -577,13 +577,16 @@ gboolean client_focus(ObClient *self); when the user deliberately selects a window for use. @param desktop If true, and the window is on another desktop, it will still be activated. + @param here If true, and the window is on another desktop, it will be moved + to the current desktop, otherwise the desktop will switch to + where the window is. @param raise If true, the client is brought to the front. @param unshade If true, the client is unshaded (if it is shaded) @param user If true, then a user action is what requested the activation; otherwise, it means an application requested it on its own */ -void client_activate(ObClient *self, gboolean desktop, gboolean raise, - gboolean unshade, gboolean user); +void client_activate(ObClient *self, gboolean desktop, gboolean here, + gboolean raise, gboolean unshade, gboolean user); /*! Bring all of its helper windows to its desktop. These are the utility and stuff windows. */ diff --git a/openbox/client_list_combined_menu.c b/openbox/client_list_combined_menu.c index ad23cd48..593010eb 100644 --- a/openbox/client_list_combined_menu.c +++ b/openbox/client_list_combined_menu.c @@ -114,7 +114,7 @@ static void menu_execute(ObMenuEntry *self, ObMenuFrame *f, else { ObClient *t = self->data.normal.data; if (t) { /* it's set to NULL if its destroyed */ - client_activate(t, TRUE, TRUE, TRUE, TRUE); + client_activate(t, TRUE, FALSE, TRUE, TRUE, TRUE); /* if the window is omnipresent then we need to go to its desktop */ if (t->desktop == DESKTOP_ALL) diff --git a/openbox/client_list_menu.c b/openbox/client_list_menu.c index ca4534ba..2e87259b 100644 --- a/openbox/client_list_menu.c +++ b/openbox/client_list_menu.c @@ -101,7 +101,7 @@ static void desk_menu_execute(ObMenuEntry *self, ObMenuFrame *f, { ObClient *t = self->data.normal.data; if (t) { /* it's set to NULL if its destroyed */ - client_activate(t, TRUE, TRUE, TRUE, TRUE); + client_activate(t, TRUE, FALSE, TRUE, TRUE, TRUE); /* if the window is omnipresent then we need to go to its desktop */ if (t->desktop == DESKTOP_ALL) diff --git a/openbox/event.c b/openbox/event.c index e07d6a31..b4bd8270 100644 --- a/openbox/event.c +++ b/openbox/event.c @@ -1276,7 +1276,7 @@ static void event_handle_client(ObClient *client, XEvent *e) it can happen now when the window is on another desktop, but we still don't want it! */ - client_activate(client, FALSE, TRUE, TRUE, TRUE); + client_activate(client, FALSE, FALSE, TRUE, TRUE, TRUE); break; case ClientMessage: /* validate cuz we query stuff off the client here */ @@ -1332,7 +1332,7 @@ static void event_handle_client(ObClient *client, XEvent *e) ob_debug_type(OB_DEBUG_APP_BUGS, "_NET_ACTIVE_WINDOW message for window %s is " "missing source indication\n", client->title); - client_activate(client, FALSE, TRUE, TRUE, + client_activate(client, FALSE, FALSE, TRUE, TRUE, (e->xclient.data.l[0] == 0 || e->xclient.data.l[0] == 2)); } else if (msgtype == prop_atoms.net_wm_moveresize) {