[tigervnc] Press fake modifiers correctly (#633931).

Adam Tkac atkac at fedoraproject.org
Thu Sep 16 12:03:38 UTC 2010


commit 31632b328ecbc2a16ca75f63dd0c084915358c8f
Author: Adam Tkac <atkac at redhat.com>
Date:   Thu Sep 16 13:05:44 2010 +0200

    Press fake modifiers correctly (#633931).
    
    Signed-off-by: Adam Tkac <atkac at redhat.com>

 tigervnc.spec             |    7 +++-
 tigervnc11-rh633931.patch |   87 +++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 93 insertions(+), 1 deletions(-)
---
diff --git a/tigervnc.spec b/tigervnc.spec
index 8ef01ee..8684955 100644
--- a/tigervnc.spec
+++ b/tigervnc.spec
@@ -2,7 +2,7 @@
 
 Name:		tigervnc
 Version:	1.0.90
-Release:	0.19.%{snap}%{?dist}
+Release:	0.20.%{snap}%{?dist}
 Summary:	A TigerVNC remote display system
 
 Group:		User Interface/Desktops
@@ -45,6 +45,7 @@ Patch8:		tigervnc-viewer-reparent.patch
 Patch10:	tigervnc11-ldnow.patch
 Patch11:	0001-Return-Success-from-generate_modkeymap-when-max_keys.patch
 Patch12:	tigervnc11-rh611677.patch
+Patch13:	tigervnc11-rh633931.patch
 
 %description
 Virtual Network Computing (VNC) is a remote display system which
@@ -133,6 +134,7 @@ This package contains license of the TigerVNC suite
 %patch8 -p1 -b .viewer-reparent
 %patch10 -p1 -b .ldnow
 %patch12 -p1 -b .rh611677
+%patch13 -p1 -b .rh633931
 
 cp -r /usr/share/xorg-x11-server-source/* unix/xserver
 pushd unix/xserver
@@ -303,6 +305,9 @@ fi
 %doc LICENCE.TXT
 
 %changelog
+* Thu Sep 16 2010 Adam Tkac <atkac redhat com> 1.0.90-0.20.20100813svn4123
+- press fake modifiers correctly (#633931)
+
 * Wed Aug 25 2010 Adam Tkac <atkac redhat com> 1.0.90-0.19.20100813svn4123
 - separate Xvnc, vncpasswd and vncconfig to -server-minimal subpkg (#626946)
 - move license to separate subpkg and Requires it from main subpkgs
diff --git a/tigervnc11-rh633931.patch b/tigervnc11-rh633931.patch
new file mode 100644
index 0000000..71797d5
--- /dev/null
+++ b/tigervnc11-rh633931.patch
@@ -0,0 +1,87 @@
+diff -up tigervnc-1.0.90-20100813svn4123/unix/xserver/hw/vnc/Input.cc.rh633931 tigervnc-1.0.90-20100813svn4123/unix/xserver/hw/vnc/Input.cc
+--- tigervnc-1.0.90-20100813svn4123/unix/xserver/hw/vnc/Input.cc.rh633931	2010-09-16 11:29:33.670000097 +0200
++++ tigervnc-1.0.90-20100813svn4123/unix/xserver/hw/vnc/Input.cc	2010-09-16 12:59:31.530002411 +0200
+@@ -271,6 +271,19 @@ void InputDevice::initInputDevice(void)
+ #endif
+ }
+ 
++static inline void pressKey(DeviceIntPtr dev, int kc, bool down, const char *msg)
++{
++	int action;
++	unsigned int n;
++
++	if (msg != NULL)
++		vlog.debug("%s %d %s", msg, kc, down ? "down" : "up");
++
++	action = down ? KeyPress : KeyRelease;
++	n = GetKeyboardEvents(eventq, dev, action, kc);
++	enqueueEvents(dev, n);
++}
++
+ #define IS_PRESSED(keyc, keycode) \
+ 	((keyc)->down[(keycode) >> 3] & (1 << ((keycode) & 7)))
+ 
+@@ -294,7 +307,7 @@ public:
+ 	~ModifierState()
+ 	{
+ 		for (int i = 0; i < nKeys; i++)
+-			generateXKeyEvent(keys[i], !pressed);
++			pressKey(dev, keys[i], !pressed, "fake keycode");
+ 		delete [] keys;
+ 	}
+ 
+@@ -389,22 +402,10 @@ private:
+ 		if (keycode) {
+ 			if (!keys) keys = new int[maxKeysPerMod];
+ 			keys[nKeys++] = keycode;
+-			generateXKeyEvent(keycode, down);
++			pressKey(dev, keycode, down, "fake keycode");
+ 		}
+ 	}
+ 
+-	void generateXKeyEvent(int keycode, bool down)
+-	{
+-		int n, action;
+-
+-		action = down ? KeyPress : KeyRelease;
+-		n = GetKeyboardEvents(eventq, dev, action, keycode);
+-		enqueueEvents(dev, n);
+-
+-		vlog.debug("fake keycode %d %s", keycode,
+-			   down ? "down" : "up");
+-	}
+-
+ 	int modIndex;
+ 	int nKeys;
+ 	int *keys;
+@@ -503,8 +504,8 @@ void InputDevice::keyEvent(rdr::U32 keys
+ 	KeyCode minKeyCode, maxKeyCode;
+ 	KeyCode *modmap = NULL;
+ 	int mapWidth;
+-	unsigned int i, n;
+-	int j, k, action, state, maxKeysPerMod;
++	unsigned int i;
++	int j, k, state, maxKeysPerMod;
+ 
+ 	initInputDevice();
+ 
+@@ -691,12 +692,14 @@ ModeSwitchFound:
+ 					modeSwitch.release();
+ 			}
+ 		}
+-	}
++		/*
++		 * Ensure ModifierState objects are not destroyed before
++		 * pressKey call, otherwise fake modifier keypress can be lost.
++		 */
++		pressKey(keyboardDev, kc, down, "keycode");
++	} else
++		pressKey(keyboardDev, kc, down, "keycode");
+ 
+-	vlog.debug("keycode %d %s", kc, down ? "down" : "up");
+-	action = down ? KeyPress : KeyRelease;
+-	n = GetKeyboardEvents(eventq, keyboardDev, action, kc);
+-	enqueueEvents(keyboardDev, n);
+ 
+         FREE_MAPS;
+ 	


More information about the scm-commits mailing list