Re: [gtk-vnc-devel] PATCH: sticky modifier keys

Daniel P. Berrange wrote:
On Mon, Jul 09, 2007 at 09:11:12AM -0500, Anthony Liguori wrote:
Daniel P. Berrange wrote:
Even with the use of a keyboard grab, there are certain key combinations
that are completely ungrabbable using regular GTK / X libraries. The prime
examples are  Ctrl-Alt-Backspace, and  Ctrl+Alt+Fn.  This isn't a problem
for traditional VNC servers, but when talking to a virtualed guest OS, then
you do need a way to send these combos to the guest OS.

This patch adds the 'sticky modifiers' concept currently used in virt-manager
Basically, if a Ctrl or Alt key is pressed 3 times in a row, then it is
treated as sticky until the next non-modifier key is released. This allows
you to type  'Ctrl Ctrl Ctrl Alt+F1'  to send 'Ctrl+Alt+F1' to the guest.
This is off by default.
Hrm, I don't like this very much. I'd prefer a sendkey like abstraction and then virt-manager could implement "stick modifiers" if it was desired.

How about a method taking

    vnc_display_send_key(VncDisplay *vnc, int *keysyms);

Where keysyms is a NULL terminated array of GTK keysym codes. Or could
explicitly have a count

    vnc_display_send_key(VncDisplay *vnc, int *keysyms, int nkeysyms);

In either case, if there was > 1 keysym listed, it would send all the
key down events, and then all the key up events. This would let you send Ctrl+Alt+Del in single call, rather than having have another
up/down parameter to vnc_display_send_key method.


   int cad[] = { GDK_Control_L, GDK_Alt_L, GDK_Delete, 0 }
   vnc_display_send_key(vnc, cad);


   int cad[] = { GDK_Control_L, GDK_Alt_L, GDK_Delete }
   vnc_display_send_key(vnc, cad, sizeof(cad)/sizeof(cad[0]));

I prefer this syntax personally.  0 might be a valid key after all.


Anthony Liguori

I think a much more common way of addressing this problem will be to have a menu entry allowing certain combinations to be sent. The big usability problem with sticky modifiers is that if a user mistypes, something really bad could happen (like restarting X).

I think ultimately, both a menu full of special keys & sticky keys
are both ugly hacks. The ultimate is to be able to grab the keyboard
and be able to enter all possible key strokes.

One of the desktop / X guys  at Red Hat suggested I might want to also
try out using  XKB apis which would let us block the special Ctrl-Alt+Fn
and Ctrl-Alt-Backspace/Del  sequences from the local host too, while in
a keygrab scenario. In the mean time, the send_key thing should be sufficient.

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