Handle init of old and new keyboards the same way.


git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5071 3789f03b-4d11-0410-bbf8-ca57d06f2519
diff --git a/unix/xserver/hw/vnc/Input.cc b/unix/xserver/hw/vnc/Input.cc
index 7a75c70..80490e6 100644
--- a/unix/xserver/hw/vnc/Input.cc
+++ b/unix/xserver/hw/vnc/Input.cc
@@ -130,21 +130,6 @@
 InputDevice::InputDevice(rfb::VNCServerST *_server)
 	: server(_server), initialized(false), oldButtonMask(0)
 {
-#if XORG < 17
-	pointerDev = AddInputDevice(
-#if XORG >= 16
-				    serverClient,
-#endif
-				    pointerProc, TRUE);
-	RegisterPointerDevice(pointerDev);
-
-	keyboardDev = AddInputDevice(
-#if XORG >= 16
-				     serverClient,
-#endif
-				     keyboardProc, TRUE);
-	RegisterKeyboardDevice(keyboardDev);
-#endif
 #if XORG < 111
 	initEventq();
 #endif
@@ -285,14 +270,36 @@
 
 void InputDevice::InitInputDevice(void)
 {
-#if XORG >= 17
-	int ret;
-
-	if (!initialized)
+	if (initialized)
 		return;
 
 	initialized = true;
 
+#if XORG < 17
+	pointerDev = AddInputDevice(
+#if XORG >= 16
+				    serverClient,
+#endif
+				    pointerProc, TRUE);
+	RegisterPointerDevice(pointerDev);
+
+	keyboardDev = AddInputDevice(
+#if XORG >= 16
+				     serverClient,
+#endif
+				     keyboardProc, TRUE);
+	RegisterKeyboardDevice(keyboardDev);
+
+	if (ActivateDevice(pointerDev) != Success ||
+	    ActivateDevice(keyboardDev) != Success)
+		FatalError("Failed to activate TigerVNC devices\n");
+
+	if (!EnableDevice(pointerDev) ||
+	    !EnableDevice(keyboardDev))
+		FatalError("Failed to enable TigerVNC devices\n");
+#else /* < 17 */
+	int ret;
+
 	ret = AllocDevicePair(serverClient, "TigerVNC", &pointerDev,
 			      &keyboardDev, pointerProc, keyboardProc,
 			      FALSE);
@@ -307,7 +314,7 @@
 	if (!EnableDevice(pointerDev, TRUE) ||
 	    !EnableDevice(keyboardDev, TRUE))
 		FatalError("Failed to activate TigerVNC devices\n");
-#endif
+#endif /* 17 */
 }
 
 static inline void pressKey(DeviceIntPtr dev, int kc, bool down, const char *msg)