Re: how to escape key events?



* Eli Barzilay <eli barzilay org> wrote:
> > What would be ideal is a special keypress used as a prefix,
> > meaning "send next event as-is to focused application, without
> > interpreting it"...  similar to C-V in vim, I suppose.  Is there
> > such a thing in sawfish?
> 
> Lookup `quote-event'.

I finally tried this today, and I wonder if I'm doing something
wrong.  Here's what I added to my config:

  (bind-keys global-keymap "H-q" 'quote-event)

  (require 'better-quote-event)
  (bind-keys global-keymap "H-z" 'quote-event-that-works)

Afterward, pressing H-q or H-z causes a "Quote" notice to display
until after my next keypress.  Then I can press something such as
H-Left or C-Up, and sawfish does not react as usual.  So far, so
good.  The problem is that the quoted event doesn't seem to work
as expected.  Events get either omitted or sent in the wrong
order.

For example, I tried pressing "H-q C-Down" and "H-z C-Down" in
xev, both locally and over VNC, to see what happened.  Both were
the same over VNC -- right events, wrong order:

  KeyPress event, serial 24, synthetic NO, window 0x7c00001,
      state 0x0, keycode 115 (keysym 0xffed, Hyper_L), same_screen YES,

  KeyRelease event, serial 24, synthetic NO, window 0x7c00001,
      state 0x40, keycode 115 (keysym 0xffed, Hyper_L), same_screen YES,

  KeyPress event, serial 24, synthetic NO, window 0x7c00001,
      state 0x0, keycode 104 (keysym 0xff54, Down), same_screen YES,

  KeyRelease event, serial 24, synthetic NO, window 0x7c00001,
      state 0x0, keycode 104 (keysym 0xff54, Down), same_screen YES,

  KeyPress event, serial 24, synthetic NO, window 0x7c00001,
      state 0x0, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,

  KeyRelease event, serial 24, synthetic NO, window 0x7c00001,
      state 0x4, keycode 37 (keysym 0xffe3, Control_L), same_screen YES,

The 5th event should come before the 3rd, and the state is wrong
on events 3 and 4.

Using xev locally, I get different results.  With quote-event:

  KeyPress event, serial 29, synthetic NO, window 0x1e00001,
      state 0x0, keycode 115 (keysym 0xffed, Hyper_L), same_screen YES,

  KeyPress event, serial 29, synthetic NO, window 0x1e00001,
      state 0x4, keycode 104 (keysym 0xff54, Down), same_screen YES,

  KeyRelease event, serial 29, synthetic NO, window 0x1e00001,
      state 0x4, keycode 104 (keysym 0xff54, Down), same_screen YES,

  KeyRelease event, serial 29, synthetic NO, window 0x1e00001,
      state 0x4, keycode 66 (keysym 0xffe3, Control_L), same_screen YES,

The state and order are both correct, but the KeyRelease for
Hyper and the KeyPress for Control_L are missing.

With quote-event-that-works, the result is similar but with some
extra mapping and such.  I won't bother pasting the details.


> But personally, I have this code (my .vnc/xstartup has
> "INVNC="yes"; export INVNC"):

That's a neat idea, though I don't use VNC in a manner which
would allow that.  The VNC server either has no configurable
xstartup (as when installing linux over VNC), or is exported from
a real display with x11vnc.  So, I can't change environment
variables to indicate whether VNC is in use.

However, I might be able to do some sort of window-specific
keymap which simply overrides the global keys when a VNC viewer
is focused.  I'm not exactly sure how, but I figure there's a way
to make all windows of a given class override the global keymap.
... perhaps detect when vnc is focused, and set override-keymap
to a special vnc-keymap...  and set override-keymap back to nil
for any other window?

> BTW -- if you're using sawfish on vnc, a good tip is to use a
> window scheme that is not using fancy decorations, they eat up
> your bandwidth on eye candy.

I'm not too worried abouth bandwidth.  The slowest link I'm using
is 8mbit/s, so even detailed wallpaper isn't a big problem.


Anyway, thanks for the info and ideas.  I've got a much better
idea now how to do this.  :)


-- Scott



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