Metacity and forwarding key press at grab end?



I have ctrl + up|down|left|right bound to workspace switch.  Consider
an example of switching workspace down and sending ctrl + c to terminal
window:

 1.  press ctrl
 2.  press down, release down
 3.  release ctrl
 4.  press ctrl, press c

I would like to skip the redundant release/press ctrl sequence, that is:

 1.  press ctrl
 2.  press down, release down
 3.  press c

Currently grab is ended when unused key is pressed (in step 3) but the
event is discarded (keybindings.c:meta_display_process_key_event()).
Is it possible to forward it to focused window instead of discarding?

I'm not familiar with X programming but wanted to experiment a little,
so I tried a small change below.  Even though 'xev' then sees the
forwarded event (KeyPress from step 3) it still doesn't actually work
in practice.  Maybe this is not the correct approach?


diff -u -r1.111 keybindings.c
--- keybindings.c       26 May 2005 19:58:17 -0000      1.111
+++ keybindings.c       25 Jun 2005 20:23:32 -0000
@@ -1675,6 +1675,11 @@
                   "Ending grab op %d on key event sym %s\n",
                   display->grab_op, XKeysymToString (keysym));
       meta_display_end_grab_op (display, event->xkey.time);
+      XSendEvent (display->xdisplay,
+                 display->focus_window->xwindow,
+                 False,
+                 0,
+                 event);
     }
 }


--
Tero




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]