Fix client_activate() to work for internal Openbox menus
authorDana Jansens <danakj@orodu.net>
Tue, 8 Dec 2009 16:32:40 +0000 (11:32 -0500)
committerDana Jansens <danakj@orodu.net>
Tue, 8 Dec 2009 18:56:37 +0000 (13:56 -0500)
client_activate() is a helpful way to focus a window on another desktop,
but only Openbox is allowed to do such things, user messages cannot.

openbox/client.c
openbox/client.h
openbox/client_list_combined_menu.c
openbox/client_list_menu.c
openbox/event.c

index 91693f9..ecb4aaf 100644 (file)
@@ -3929,14 +3929,15 @@ static void client_present(ObClient *self, gboolean here, gboolean raise,
 }
 
 /* this function exists to map to the net_active_window message in the ewmh */
 }
 
 /* this function exists to map to the net_active_window message in the ewmh */
-void client_activate(ObClient *self, gboolean here, gboolean raise,
+void client_activate(ObClient *self, gboolean desktop, gboolean raise,
                      gboolean unshade, gboolean user)
 {
                      gboolean unshade, gboolean user)
 {
-    if ((user && (self->desktop == DESKTOP_ALL ||
+    if ((user && (desktop ||
+                  self->desktop == DESKTOP_ALL ||
                   self->desktop == screen_desktop)) ||
         client_can_steal_focus(self, event_curtime, CurrentTime))
     {
                   self->desktop == screen_desktop)) ||
         client_can_steal_focus(self, event_curtime, CurrentTime))
     {
-        client_present(self, here, raise, unshade);
+        client_present(self, FALSE, raise, unshade);
     }
     else
         client_hilite(self, TRUE);
     }
     else
         client_hilite(self, TRUE);
index 832405c..15ae222 100644 (file)
@@ -575,14 +575,14 @@ gboolean client_focus(ObClient *self);
 
 /*! Activates the client for use, focusing, uniconifying it, etc. To be used
   when the user deliberately selects a window for use.
 
 /*! Activates the client for use, focusing, uniconifying it, etc. To be used
   when the user deliberately selects a window for use.
-  @param here If true, then the client is brought to the current desktop;
-              otherwise, the desktop is changed to where the client lives.
+  @param desktop If true, and the window is on another desktop, it will still
+                 be activated.
   @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
 */
   @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 here, gboolean raise,
+void client_activate(ObClient *self, gboolean desktop, gboolean raise,
                      gboolean unshade, gboolean user);
 
 /*! Bring all of its helper windows to its desktop. These are the utility and
                      gboolean unshade, gboolean user);
 
 /*! Bring all of its helper windows to its desktop. These are the utility and
index a04d07d..ad23cd4 100644 (file)
@@ -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 */
     else {
         ObClient *t = self->data.normal.data;
         if (t) { /* it's set to NULL if its destroyed */
-            client_activate(t, FALSE, TRUE, TRUE, TRUE);
+            client_activate(t, TRUE, TRUE, TRUE, TRUE);
             /* if the window is omnipresent then we need to go to its
                desktop */
             if (t->desktop == DESKTOP_ALL)
             /* if the window is omnipresent then we need to go to its
                desktop */
             if (t->desktop == DESKTOP_ALL)
index 4ec6e78..ca4534b 100644 (file)
@@ -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 */
 {
     ObClient *t = self->data.normal.data;
     if (t) { /* it's set to NULL if its destroyed */
-        client_activate(t, FALSE, TRUE, TRUE, TRUE);
+        client_activate(t, TRUE, TRUE, TRUE, TRUE);
         /* if the window is omnipresent then we need to go to its
            desktop */
         if (t->desktop == DESKTOP_ALL)
         /* if the window is omnipresent then we need to go to its
            desktop */
         if (t->desktop == DESKTOP_ALL)
index 93c5fa2..e07d6a3 100644 (file)
@@ -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);
                 ob_debug_type(OB_DEBUG_APP_BUGS,
                               "_NET_ACTIVE_WINDOW message for window %s is "
                               "missing source indication\n", client->title);
-            client_activate(client, TRUE, TRUE, TRUE,
+            client_activate(client, FALSE, TRUE, TRUE,
                             (e->xclient.data.l[0] == 0 ||
                              e->xclient.data.l[0] == 2));
         } else if (msgtype == prop_atoms.net_wm_moveresize) {
                             (e->xclient.data.l[0] == 0 ||
                              e->xclient.data.l[0] == 2));
         } else if (msgtype == prop_atoms.net_wm_moveresize) {