[openbox] an alternative to underMouse, was: Re: [openbox] MoveToEdge loses focus in 3.4.4

Brian de Alwis bsd at cs.ubc.ca
Thu Aug 23 16:54:10 EDT 2007


I took a stab at implementing a Refocus action.  With this action,
I've reverted to <underMouse>no</underMouse>, removed the
Activate commands from my keybindings for MoveToEdge*, and
instead added a Refocus after my RaiseLower.

Andrei's run with it for a couple of days, as have I, and have
experienced no problems.  Better yet, we haven't experienced the
previous problems.

For the implementation, the action punts everything to focus_fallback().
This doesn't seem to do anything when <followMouse>no</followMouse>.
I could see that such users might appreciate an a keyboard-activated
action to refocus.

Brian.

On 2007.08.17 02:42:18 +0300, Andrei Paskevich wrote:
> As for "Refocus" action, that's exactly what I've proposed in
> an earlier message. I still believe it could be a useful option.

-- 
  Brian de Alwis | Software Practices Lab | UBC | http://www.cs.ubc.ca/~bsd/
      "Amusement to an observing mind is study." - Benjamin Disraeli
-------------- next part --------------
diff -ruwbNd openbox-3.4.4-untouched/Makefile.am openbox-3.4.4/Makefile.am
--- openbox-3.4.4-untouched/Makefile.am	2007-08-04 15:39:58.000000000 -0600
+++ openbox-3.4.4/Makefile.am	2007-08-22 00:35:39.000000000 -0600
@@ -162,6 +162,7 @@
 	openbox/actions/execute.c \
 	openbox/actions/exit.c \
 	openbox/actions/focus.c \
+	openbox/actions/refocus.c \
 	openbox/actions/focustobottom.c \
 	openbox/actions/fullscreen.c \
 	openbox/actions/growtoedge.c \
diff -ruwbNd openbox-3.4.4-untouched/Makefile.in openbox-3.4.4/Makefile.in
--- openbox-3.4.4-untouched/Makefile.in	2007-08-04 15:41:40.000000000 -0600
+++ openbox-3.4.4/Makefile.in	2007-08-22 00:44:39.000000000 -0600
@@ -133,6 +133,7 @@
 	openbox/actions/openbox_openbox-execute.$(OBJEXT) \
 	openbox/actions/openbox_openbox-exit.$(OBJEXT) \
 	openbox/actions/openbox_openbox-focus.$(OBJEXT) \
+	openbox/actions/openbox_openbox-refocus.$(OBJEXT) \
 	openbox/actions/openbox_openbox-focustobottom.$(OBJEXT) \
 	openbox/actions/openbox_openbox-fullscreen.$(OBJEXT) \
 	openbox/actions/openbox_openbox-growtoedge.$(OBJEXT) \
@@ -602,6 +603,7 @@
 	openbox/actions/execute.c \
 	openbox/actions/exit.c \
 	openbox/actions/focus.c \
+	openbox/actions/refocus.c \
 	openbox/actions/focustobottom.c \
 	openbox/actions/fullscreen.c \
 	openbox/actions/growtoedge.c \
@@ -1094,6 +1096,9 @@
 openbox/actions/openbox_openbox-focus.$(OBJEXT):  \
 	openbox/actions/$(am__dirstamp) \
 	openbox/actions/$(DEPDIR)/$(am__dirstamp)
+openbox/actions/openbox_openbox-refocus.$(OBJEXT):  \
+	openbox/actions/$(am__dirstamp) \
+	openbox/actions/$(DEPDIR)/$(am__dirstamp)
 openbox/actions/openbox_openbox-focustobottom.$(OBJEXT):  \
 	openbox/actions/$(am__dirstamp) \
 	openbox/actions/$(DEPDIR)/$(am__dirstamp)
@@ -1194,6 +1199,8 @@
 	openbox/$(DEPDIR)/$(am__dirstamp)
 openbox/openbox_openbox-focus.$(OBJEXT): openbox/$(am__dirstamp) \
 	openbox/$(DEPDIR)/$(am__dirstamp)
+openbox/openbox_openbox-refocus.$(OBJEXT): openbox/$(am__dirstamp) \
+	openbox/$(DEPDIR)/$(am__dirstamp)
 openbox/openbox_openbox-focus_cycle.$(OBJEXT):  \
 	openbox/$(am__dirstamp) openbox/$(DEPDIR)/$(am__dirstamp)
 openbox/openbox_openbox-focus_cycle_indicator.$(OBJEXT):  \
@@ -1303,6 +1310,7 @@
 	-rm -f openbox/actions/openbox_openbox-execute.$(OBJEXT)
 	-rm -f openbox/actions/openbox_openbox-exit.$(OBJEXT)
 	-rm -f openbox/actions/openbox_openbox-focus.$(OBJEXT)
+	-rm -f openbox/actions/openbox_openbox-refocus.$(OBJEXT)
 	-rm -f openbox/actions/openbox_openbox-focustobottom.$(OBJEXT)
 	-rm -f openbox/actions/openbox_openbox-fullscreen.$(OBJEXT)
 	-rm -f openbox/actions/openbox_openbox-growtoedge.$(OBJEXT)
@@ -1440,6 +1448,7 @@
 @AMDEP_TRUE@@am__include@ @am__quote at openbox/actions/$(DEPDIR)/openbox_openbox-execute.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at openbox/actions/$(DEPDIR)/openbox_openbox-exit.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at openbox/actions/$(DEPDIR)/openbox_openbox-focus.Po at am__quote@
+ at AMDEP_TRUE@@am__include@ @am__quote at openbox/actions/$(DEPDIR)/openbox_openbox-refocus.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at openbox/actions/$(DEPDIR)/openbox_openbox-focustobottom.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at openbox/actions/$(DEPDIR)/openbox_openbox-fullscreen.Po at am__quote@
 @AMDEP_TRUE@@am__include@ @am__quote at openbox/actions/$(DEPDIR)/openbox_openbox-growtoedge.Po at am__quote@
@@ -1745,6 +1754,20 @@
 @AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
 @am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openbox_openbox_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o openbox/actions/openbox_openbox-focus.obj `if test -f 'openbox/actions/focus.c'; then $(CYGPATH_W) 'openbox/actions/focus.c'; else $(CYGPATH_W) '$(srcdir)/openbox/actions/focus.c'; fi`
 
+openbox/actions/openbox_openbox-refocus.o: openbox/actions/refocus.c
+ at am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openbox_openbox_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT openbox/actions/openbox_openbox-refocus.o -MD -MP -MF "openbox/actions/$(DEPDIR)/openbox_openbox-refocus.Tpo" -c -o openbox/actions/openbox_openbox-refocus.o `test -f 'openbox/actions/refocus.c' || echo '$(srcdir)/'`openbox/actions/refocus.c; \
+ at am__fastdepCC_TRUE@	then mv -f "openbox/actions/$(DEPDIR)/openbox_openbox-refocus.Tpo" "openbox/actions/$(DEPDIR)/openbox_openbox-refocus.Po"; else rm -f "openbox/actions/$(DEPDIR)/openbox_openbox-refocus.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='openbox/actions/refocus.c' object='openbox/actions/openbox_openbox-refocus.o' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openbox_openbox_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o openbox/actions/openbox_openbox-refocus.o `test -f 'openbox/actions/refocus.c' || echo '$(srcdir)/'`openbox/actions/refocus.c
+
+openbox/actions/openbox_openbox-refocus.obj: openbox/actions/refocus.c
+ at am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openbox_openbox_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT openbox/actions/openbox_openbox-refocus.obj -MD -MP -MF "openbox/actions/$(DEPDIR)/openbox_openbox-refocus.Tpo" -c -o openbox/actions/openbox_openbox-refocus.obj `if test -f 'openbox/actions/refocus.c'; then $(CYGPATH_W) 'openbox/actions/refocus.c'; else $(CYGPATH_W) '$(srcdir)/openbox/actions/refocus.c'; fi`; \
+ at am__fastdepCC_TRUE@	then mv -f "openbox/actions/$(DEPDIR)/openbox_openbox-refocus.Tpo" "openbox/actions/$(DEPDIR)/openbox_openbox-refocus.Po"; else rm -f "openbox/actions/$(DEPDIR)/openbox_openbox-refocus.Tpo"; exit 1; fi
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	source='openbox/actions/refocus.c' object='openbox/actions/openbox_openbox-refocus.obj' libtool=no @AMDEPBACKSLASH@
+ at AMDEP_TRUE@@am__fastdepCC_FALSE@	DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@
+ at am__fastdepCC_FALSE@	$(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openbox_openbox_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o openbox/actions/openbox_openbox-refocus.obj `if test -f 'openbox/actions/refocus.c'; then $(CYGPATH_W) 'openbox/actions/refocus.c'; else $(CYGPATH_W) '$(srcdir)/openbox/actions/refocus.c'; fi`
+
 openbox/actions/openbox_openbox-focustobottom.o: openbox/actions/focustobottom.c
 @am__fastdepCC_TRUE@	if $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(openbox_openbox_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT openbox/actions/openbox_openbox-focustobottom.o -MD -MP -MF "openbox/actions/$(DEPDIR)/openbox_openbox-focustobottom.Tpo" -c -o openbox/actions/openbox_openbox-focustobottom.o `test -f 'openbox/actions/focustobottom.c' || echo '$(srcdir)/'`openbox/actions/focustobottom.c; \
 @am__fastdepCC_TRUE@	then mv -f "openbox/actions/$(DEPDIR)/openbox_openbox-focustobottom.Tpo" "openbox/actions/$(DEPDIR)/openbox_openbox-focustobottom.Po"; else rm -f "openbox/actions/$(DEPDIR)/openbox_openbox-focustobottom.Tpo"; exit 1; fi
diff -ruwbNd openbox-3.4.4-untouched/data/rc.xsd openbox-3.4.4/data/rc.xsd
--- openbox-3.4.4-untouched/data/rc.xsd	2007-08-04 15:39:58.000000000 -0600
+++ openbox-3.4.4/data/rc.xsd	2007-08-22 10:49:00.000000000 -0600
@@ -245,6 +245,7 @@
             <xsd:enumeration value="Raise"/>
             <xsd:enumeration value="RaiseLower"/>
             <xsd:enumeration value="Reconfigure"/>
+            <xsd:enumeration value="Refocus"/>
             <xsd:enumeration value="Resize"/>
             <xsd:enumeration value="ResizeRelative"/>
             <xsd:enumeration value="ResizeRelativeHorz"/>
diff -ruwbNd openbox-3.4.4-untouched/openbox/actions/all.c openbox-3.4.4/openbox/actions/all.c
--- openbox-3.4.4-untouched/openbox/actions/all.c	2007-08-04 15:39:59.000000000 -0600
+++ openbox-3.4.4/openbox/actions/all.c	2007-08-22 00:31:15.000000000 -0600
@@ -14,6 +14,7 @@
     action_close_startup();
     action_move_startup();
     action_focus_startup();
+    action_refocus_startup();
     action_raise_startup();
     action_lower_startup();
     action_raiselower_startup();
diff -ruwbNd openbox-3.4.4-untouched/openbox/actions/all.h openbox-3.4.4/openbox/actions/all.h
--- openbox-3.4.4-untouched/openbox/actions/all.h	2007-08-04 15:39:59.000000000 -0600
+++ openbox-3.4.4/openbox/actions/all.h	2007-08-22 00:31:21.000000000 -0600
@@ -15,6 +15,7 @@
 void action_close_startup();
 void action_move_startup();
 void action_focus_startup();
+void action_refocus_startup();
 void action_raise_startup();
 void action_lower_startup();
 void action_raiselower_startup();
diff -ruwbNd openbox-3.4.4-untouched/openbox/actions/refocus.c openbox-3.4.4/openbox/actions/refocus.c
--- openbox-3.4.4-untouched/openbox/actions/refocus.c	1969-12-31 18:00:00.000000000 -0600
+++ openbox-3.4.4/openbox/actions/refocus.c	2007-08-22 01:16:06.000000000 -0600
@@ -0,0 +1,22 @@
+#include "openbox/actions.h"
+#include "openbox/event.h"
+#include "openbox/client.h"
+#include "openbox/focus.h"
+
+static gboolean run_func(ObActionsData *data, gpointer options);
+
+void action_refocus_startup()
+{
+    actions_register("Refocus",
+                     NULL,
+                     NULL,
+                     run_func,
+                     NULL, NULL);
+}
+
+/* Always return FALSE because its not interactive */
+static gboolean run_func(ObActionsData *data, gpointer options)
+{
+    focus_fallback(TRUE, TRUE, TRUE, FALSE);
+    return FALSE;
+}


More information about the openbox mailing list