[tigervnc/f14/master] Attempt to fix various keyboard issues (#607866).

Adam Tkac atkac at fedoraproject.org
Fri Jan 14 13:26:23 UTC 2011


commit a3e64faeba4c2187afaae1d8f1b8c04dca1ecbf3
Author: Adam Tkac <atkac at redhat.com>
Date:   Fri Jan 14 14:25:46 2011 +0100

    Attempt to fix various keyboard issues (#607866).
    
    - 0001-Return-Success-from-generate_modkeymap-when-max_keys.patch
      has been merged to the xorg-x11-server
    
    Signed-off-by: Adam Tkac <atkac at redhat.com>

 ...ess-from-generate_modkeymap-when-max_keys.patch |   60 --------
 tigervnc.spec                                      |   14 ++-
 tigervnc11-rh607866.patch                          |  156 ++++++++++++++++++++
 3 files changed, 166 insertions(+), 64 deletions(-)
---
diff --git a/tigervnc.spec b/tigervnc.spec
index 9b573f2..da27503 100644
--- a/tigervnc.spec
+++ b/tigervnc.spec
@@ -2,7 +2,7 @@
 
 Name:		tigervnc
 Version:	1.0.90
-Release:	0.22.%{snap}%{?dist}.1
+Release:	0.24.%{snap}%{?dist}
 Summary:	A TigerVNC remote display system
 
 Group:		User Interface/Desktops
@@ -43,9 +43,9 @@ Patch0:		tigervnc-102434.patch
 Patch4:		tigervnc-cookie.patch
 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
+Patch14:	tigervnc11-rh607866.patch
 
 %description
 Virtual Network Computing (VNC) is a remote display system which
@@ -133,6 +133,7 @@ This package contains license of the TigerVNC suite
 %patch10 -p1 -b .ldnow
 %patch12 -p1 -b .rh611677
 %patch13 -p1 -b .rh633931
+%patch14 -p1 -b .rh607866
 
 cp -r /usr/share/xorg-x11-server-source/* unix/xserver
 pushd unix/xserver
@@ -140,7 +141,6 @@ for all in `find . -type f -perm -001`; do
 	chmod -x "$all"
 done
 patch -p1 -b --suffix .vnc < ../xserver19.patch
-%patch11 -p1 -b .rh611677-xorg
 popd
 
 # Use newer gettext
@@ -173,7 +173,8 @@ autoreconf -fiv
 	--disable-config-dbus \
 	--disable-config-hal \
 	--disable-config-udev \
-	--with-dri-driver-path=%{_libdir}/dri
+	--with-dri-driver-path=%{_libdir}/dri \
+	--without-dtrace
 
 make %{?_smp_mflags}
 popd
@@ -303,6 +304,11 @@ fi
 %doc LICENCE.TXT
 
 %changelog
+* Fri Jan 14 2011 Adam Tkac <atkac redhat com> 1.0.90-0.24.20100420svn4030
+- 0001-Return-Success-from-generate_modkeymap-when-max_keys.patch
+  has been merged to the xorg-x11-server
+- attempt to fix various keyboard issues (#607866)
+
 * Tue Oct 05 2010 jkeating - 1.0.90-0.22.20100813svn4123.1
 - Rebuilt for gcc bug 634757
 
diff --git a/tigervnc11-rh607866.patch b/tigervnc11-rh607866.patch
new file mode 100644
index 0000000..e9afaba
--- /dev/null
+++ b/tigervnc11-rh607866.patch
@@ -0,0 +1,156 @@
+diff -up tigervnc-1.0.90-20100813svn4123/unix/xserver/hw/vnc/Input.cc.rh607866 tigervnc-1.0.90-20100813svn4123/unix/xserver/hw/vnc/Input.cc
+--- tigervnc-1.0.90-20100813svn4123/unix/xserver/hw/vnc/Input.cc.rh607866	2011-01-14 14:09:31.503156325 +0100
++++ tigervnc-1.0.90-20100813svn4123/unix/xserver/hw/vnc/Input.cc	2011-01-14 14:22:37.750812172 +0100
+@@ -495,6 +495,49 @@ static struct altKeysym_t {
+ #define FREE_MAPS
+ #endif
+ 
++#if XORG >= 17
++/*
++ * Modifier keysyms must be handled differently. Instead of finding
++ * the right row and collumn in the keymap, directly press/release
++ * the keycode which is mapped as modifier with the same keysym.
++ *
++ * This will avoid issues when there are multiple modifier keysyms
++ * in the keymap but only some of them are mapped as modifiers in
++ * the modmap.
++ *
++ * Returns keycode of the modifier key.
++ */
++
++static inline int isModifier(KeySymsPtr keymap, KeyCode *modmap,
++                             int maxKeysPerMod, rdr::U32 keysym)
++{
++	KeySym *map = keymap->map;
++	KeyCode minKeyCode = keymap->minKeyCode;
++	int mapWidth = keymap->mapWidth;
++	int i, j, k;
++
++	/* Find modifier index in the modmap */
++	for (i = 0; i < 8; i++) {
++		for (k = 0; k < maxKeysPerMod; k++) {
++			int index = i * maxKeysPerMod + k;
++			int keycode = modmap[index];
++
++			if (keycode == 0)
++				continue;
++
++			for (j = 0; j < mapWidth; j++) {
++				if (map[(keycode - minKeyCode) * mapWidth + j]
++				    == keysym) {
++					return keycode;
++				}
++			}
++		}
++	}
++
++	return -1; /* Not a modifier */
++}
++#endif
++
+ void InputDevice::keyEvent(rdr::U32 keysym, bool down)
+ {
+ 	DeviceIntPtr master;
+@@ -506,6 +549,9 @@ void InputDevice::keyEvent(rdr::U32 keys
+ 	int mapWidth;
+ 	unsigned int i;
+ 	int j, k, state, maxKeysPerMod;
++#if XORG >= 18
++	KeybdCtrl ctrl;
++#endif
+ 
+ 	initInputDevice();
+ 
+@@ -555,6 +601,18 @@ void InputDevice::keyEvent(rdr::U32 keys
+ 	maxKeyCode = keymap->maxKeyCode;
+ 	mapWidth = keymap->mapWidth;
+ 
++#if XORG >= 18
++	/*
++	 * No server-side key repeating, please. Some clients won't work well,
++	 * check https://bugzilla.redhat.com/show_bug.cgi?id=607866.
++	 */
++	ctrl = keyboardDev->kbdfeed->ctrl;
++	if (ctrl.autoRepeat != FALSE) {
++		ctrl.autoRepeat = FALSE;
++		XkbSetRepeatKeys(keyboardDev, -1, ctrl.autoRepeat);
++	}
++#endif
++
+ 	/* find which modifier Mode_switch is on. */
+ 	int modeSwitchMapIndex = 0;
+ 	for (i = 3; i < 8; i++) {
+@@ -576,7 +634,26 @@ void InputDevice::keyEvent(rdr::U32 keys
+ 	}
+ ModeSwitchFound:
+ 
++	int kc;
+ 	int col = 0;
++
++#if XORG >= 17
++	if ((kc = isModifier(keymap, modmap, maxKeysPerMod, keysym)) != -1) {
++		/*
++		 * It is a modifier key event.
++		 *
++		 * Don't do any auto-repeat because the X server will translate
++		 * each press into a release followed by a press.
++		 */
++		if (IS_PRESSED(keyc, kc) && down) {
++			FREE_MAPS;
++			return;
++		}
++
++		goto press;
++	}
++#endif
++
+ 	if (maxKeysPerMod != 0) {
+ 		if ((state & (1 << ShiftMapIndex)) != 0)
+ 			col |= 1;
+@@ -585,7 +662,7 @@ ModeSwitchFound:
+ 			col |= 2;
+ 	}
+ 
+-	int kc = KeysymToKeycode(keymap, keysym, &col);
++	kc = KeysymToKeycode(keymap, keysym, &col);
+ 
+ 	/*
+ 	 * Sort out the "shifted Tab" mess.  If we are sent a shifted Tab,
+@@ -662,6 +739,7 @@ ModeSwitchFound:
+ 		return;
+ 	}
+ 
++#if XORG < 17
+ 	/*
+ 	 * See if it's a modifier key.  If so, then don't do any auto-repeat,
+ 	 * because the X server will translate each press into a release
+@@ -676,6 +754,17 @@ ModeSwitchFound:
+ 			}	
+ 		}
+ 	}
++#else
++	/*
++	 * If you would like to press a key which is already pressed then
++	 * viewer didn't send the "release" event. In this case release it
++	 * before the press.
++	 */
++	if (IS_PRESSED(keyc, kc) && down) {
++		vlog.debug("KeyRelease for %d wasn't sent, releasing", kc);
++		pressKey(keyboardDev, kc, false, "fixing keycode");
++	}
++#endif
+ 
+ 	if (maxKeysPerMod != 0) {
+ 		ModifierState shift(keyboardDev, ShiftMapIndex);
+@@ -697,8 +786,10 @@ ModeSwitchFound:
+ 		 * pressKey call, otherwise fake modifier keypress can be lost.
+ 		 */
+ 		pressKey(keyboardDev, kc, down, "keycode");
+-	} else
++	} else {
++press:
+ 		pressKey(keyboardDev, kc, down, "keycode");
++	}
+ 
+ 
+         FREE_MAPS;


More information about the scm-commits mailing list