From bec66d47dc9324483dbb98e2dfb887678de09ed7 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Peter=20=C3=85strand?= Date: Wed, 9 Dec 2009 12:31:35 +0000 Subject: [PATCH] Avoid modifiers such as shift sticking. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/branches/1_0@3925 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- unix/xserver/hw/vnc/XserverDesktop.cc | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/unix/xserver/hw/vnc/XserverDesktop.cc b/unix/xserver/hw/vnc/XserverDesktop.cc index 9a5fb408..4e3fa9df 100644 --- a/unix/xserver/hw/vnc/XserverDesktop.cc +++ b/unix/xserver/hw/vnc/XserverDesktop.cc @@ -1104,6 +1104,14 @@ void XserverDesktop::keyEvent(rdr::U32 keysym, bool down) unsigned int i, n; int j, k; + /* + * Since we are checking the current state to determine if we need + * to fake modifiers, we must make sure that everything put on the + * input queue is processed before we start. Otherwise, shift may be + * stuck down. + */ + mieqProcessInputEvents(); + if (keysym == XK_Caps_Lock) { vlog.debug("Ignoring caps lock"); return; @@ -1220,6 +1228,15 @@ void XserverDesktop::keyEvent(rdr::U32 keysym, bool down) #endif ); } + + /* + * When faking a modifier we are putting a keycode (which can + * currently activate the desired modifier) on the input + * queue. A future modmap change can change the mapping so + * that this keycode means something else entirely. Guard + * against this by processing the queue now. + */ + mieqProcessInputEvents(); } static KeySym KeyCodetoKeySym(KeySymsPtr keymap, int keycode, int col) -- 2.39.5