[openbox] refocus on raise or lower in the followMouse mode

Andrei Paskevich andrei at capet.iut-fbleau.fr
Mon Oct 16 16:04:01 EDT 2006


On Mon, 16 Oct 2006 at 19:18:10 (+0200), Andrei Paskevich wrote:
> Also, thanks to Mikael Magnusson for his comment to Emile Snyder
> (Tue, 9 May 2006 10:17:36 +0200) about dropping client_action_*().
> It's nice to see that the behaviour we look for is already there, 
> just blocked.

Just to sum up, here is an improved patch for an option to make focus 
stay with mouse on raise and lower actions. After some meditation
on action.c and action.h, I think that it's unwise to apply that
option for any other action, even more so in client_action_*()
procedures generally. Other actions, when requested by the user, 
can be easily coupled with unfocusing in rc.xml, if needed. And 
they seem unlikely to be requested by the program (don't they?).

Any comments are highly welcome.

Best regards,
Andrei

diff -x '.*' -r -u openbox-3.3.1/data/rc.xsd openbox-3.3.1-ap/data/rc.xsd
--- openbox-3.3.1/data/rc.xsd	2006-10-13 21:34:51.000000000 +0200
+++ openbox-3.3.1-ap/data/rc.xsd	2006-10-13 21:34:49.000000000 +0200
@@ -88,6 +88,7 @@
             <xs:element minOccurs="0" name="focusNew" type="ob:bool"/>
             <xs:element minOccurs="0" name="focusLast" type="ob:bool"/>
             <xs:element minOccurs="0" name="followMouse" type="ob:bool"/>
+            <xs:element minOccurs="0" name="focusRefocus" type="ob:bool"/>
             <xs:element minOccurs="0" name="focusDelay" type="xs:integer"/>
             <xs:element minOccurs="0" name="raiseOnFocus" type="ob:bool"/>
         </xs:sequence>
diff -x '.*' -r -u openbox-3.3.1/openbox/action.c openbox-3.3.1-ap/openbox/action.c
--- openbox-3.3.1/openbox/action.c	2006-09-07 13:48:40.000000000 +0200
+++ openbox-3.3.1-ap/openbox/action.c	2006-10-16 21:35:31.000000000 +0200
@@ -1121,9 +1121,9 @@
 
 void action_raise(union ActionData *data)
 {
-    client_action_start(data);
+    if (!config_focus_refocus) client_action_start(data);
     stacking_raise(CLIENT_AS_WINDOW(data->client.any.c), data->stacking.group);
-    client_action_end(data);
+    if (!config_focus_refocus) client_action_end(data);
 }
 
 void action_unshaderaise(union ActionData *data)
@@ -1144,9 +1144,9 @@
 
 void action_lower(union ActionData *data)
 {
-    client_action_start(data);
+    if (!config_focus_refocus) client_action_start(data);
     stacking_lower(CLIENT_AS_WINDOW(data->client.any.c), data->stacking.group);
-    client_action_end(data);
+    if (!config_focus_refocus) client_action_end(data);
 }
 
 void action_close(union ActionData *data)
diff -x '.*' -r -u openbox-3.3.1/openbox/config.c openbox-3.3.1-ap/openbox/config.c
--- openbox-3.3.1/openbox/config.c	2006-09-07 13:48:40.000000000 +0200
+++ openbox-3.3.1-ap/openbox/config.c	2006-10-13 21:22:41.000000000 +0200
@@ -28,6 +28,7 @@
 #include "openbox.h"
 
 gboolean config_focus_new;
+gboolean config_focus_refocus;
 gboolean config_focus_follow;
 guint    config_focus_delay;
 gboolean config_focus_raise;
@@ -393,6 +394,8 @@
         config_focus_new = parse_bool(doc, n);
     if ((n = parse_find_node("followMouse", node)))
         config_focus_follow = parse_bool(doc, n);
+    if ((n = parse_find_node("focusRefocus", node)))
+        config_focus_refocus = parse_bool(doc, n);
     if ((n = parse_find_node("focusDelay", node)))
         config_focus_delay = parse_int(doc, n) * 1000;
     if ((n = parse_find_node("raiseOnFocus", node)))
@@ -729,6 +732,7 @@
 void config_startup(ObParseInst *i)
 {
     config_focus_new = TRUE;
+    config_focus_refocus = FALSE;
     config_focus_follow = FALSE;
     config_focus_delay = 0;
     config_focus_raise = FALSE;
diff -x '.*' -r -u openbox-3.3.1/openbox/config.h openbox-3.3.1-ap/openbox/config.h
--- openbox-3.3.1/openbox/config.h	2006-09-07 13:48:40.000000000 +0200
+++ openbox-3.3.1-ap/openbox/config.h	2006-10-13 21:20:15.000000000 +0200
@@ -32,6 +32,8 @@
 extern gboolean config_focus_new;
 /*! Focus windows when the mouse enters them */
 extern gboolean config_focus_follow;
+/*! Should we refocus on raise or lower in follow mouse mode */
+extern gboolean config_focus_refocus;
 /*! Timeout for focusing windows on focus follows mouse, in microseconds */
 extern guint    config_focus_delay;
 /*! If windows should automatically be raised when they are focused in



More information about the openbox mailing list