[openbox] how to prevent openbox to grab keystrokes ?

Mikael Magnusson mangosoft at comhem.se
Tue Mar 9 17:01:20 EST 2004


On Tue, 9 Mar 2004, Marco Molteni wrote:

> On Tue, 09 Mar 2004 16:22:01 -0500
> John Russell <drjimmy42 at yahoo.com> wrote:
> 
> > On Tue, 2004-03-09 at 16:17, Neil Watson wrote:
> > > On Tue, Mar 09, 2004 at 10:05:43PM +0100, Marco Molteni wrote:
> > > > Also, not grabbing keystrokes can be useful for other applications
> > > > besides vnc.
> > > 
> > > I agree with you.  Midnight commander would work much better if
> > > Openbox did not grab my function keys.
> > 
> > Are you still talking about remote desktops with MC?  
> > If not, then can't you just unset the keybindings in rc.xml?
> 
> If I don't misundestand you, unsetting the keybindings in rc.xml
> would have a global effect, i.e. I would loose the keybindings.
> But I don't want to loose *any* binding :-)
> 
> What I am looking for is different: a way to _temporarily_ unset
> the keybindings. This would allow for the keys to be passed to
> the application that has keyboard focus.
> 
> For example, if scroll_lock is set, do not interpret the keystrokes.
> If scroll_lock is not set, interpret the keystrokes as usual.
> 
> marco

here's a semi-ugly hack for you

--
Mikael Magnusson
-------------- next part --------------
Index: openbox/event.c
===================================================================
RCS file: /cvs/cvsroot/openbox/openbox/event.c,v
retrieving revision 1.225
diff -p -d -u -r1.225 event.c
--- openbox/event.c	15 Oct 2003 17:04:27 -0000	1.225
+++ openbox/event.c	9 Mar 2004 22:00:08 -0000
@@ -387,6 +387,7 @@ static void event_process(const XEvent *
     ObDockApp *dockapp = NULL;
     ObWindow *obwin = NULL;
     XEvent ee, *e;
+    gboolean scrolllock_pressed = !(ec->xkey.state & ScrollLockMask);
 
     /* make a copy we can mangle */
     ee = *ec;
@@ -479,7 +480,7 @@ static void event_process(const XEvent *
                 if (e->type == ButtonPress || e->type == ButtonRelease ||
                     e->type == MotionNotify)
                     mouse_event(client, e);
-                else if (e->type == KeyPress)
+                else if (e->type == KeyPress && scrollock_pressed)
                     keyboard_event((focus_cycle_target ? focus_cycle_target :
                                     (focus_hilite ? focus_hilite : client)),
                                    e);


More information about the openbox mailing list