Remove code supporting Xorg older than 1.7
diff --git a/unix/xserver/hw/vnc/Input.c b/unix/xserver/hw/vnc/Input.c
index db9bf66..7975fd6 100644
--- a/unix/xserver/hw/vnc/Input.c
+++ b/unix/xserver/hw/vnc/Input.c
@@ -32,19 +32,11 @@
 #include "inpututils.h"
 #endif
 #include "mi.h"
-#if XORG >= 16
 #include "exevents.h"
-#endif
-#if XORG == 16
-extern void
-CopyKeyClass(DeviceIntPtr device, DeviceIntPtr master);
-#endif
-#if XORG >= 17
 #include "xkbsrv.h"
 #include "xkbstr.h"
 #include "xserver-properties.h"
 extern _X_EXPORT DevPrivateKey CoreDevicePrivateKey;
-#endif
 #include <X11/keysym.h>
 #include <X11/Xlib.h>
 #include <X11/Xutil.h>
@@ -52,9 +44,7 @@
 #define BUTTONS 7
 
 /* Event queue is shared between all devices. */
-#if XORG == 15
-static xEvent *eventq = NULL;
-#elif XORG < 111
+#if XORG < 111
 static EventList *eventq = NULL;
 #endif
 
@@ -66,10 +56,6 @@
 
 static KeySym pressedKeys[256];
 
-#if XORG < 17
-extern void vncGetInitKeyboardMap(KeySymsPtr keysyms, CARD8 *modmap);
-#endif
-
 static int vncPointerProc(DeviceIntPtr pDevice, int onoff);
 static void vncKeyboardBell(int percent, DeviceIntPtr device,
                             void * ctrl, int class);
@@ -102,29 +88,6 @@
 	for (i = 0;i < 256;i++)
 		pressedKeys[i] = NoSymbol;
 
-#if XORG < 17
-	vncPointerDev = AddInputDevice(
-#if XORG >= 16
-				    serverClient,
-#endif
-				    vncPointerProc, TRUE);
-	RegisterPointerDevice(vncPointerDev);
-
-	vncKeyboardDev = AddInputDevice(
-#if XORG >= 16
-				     serverClient,
-#endif
-				     vncKeyboardProc, TRUE);
-	RegisterKeyboardDevice(vncKeyboardDev);
-
-	if (ActivateDevice(vncPointerDev) != Success ||
-	    ActivateDevice(vncKeyboardDev) != Success)
-		FatalError("Failed to activate TigerVNC devices\n");
-
-	if (!EnableDevice(vncPointerDev) ||
-	    !EnableDevice(vncKeyboardDev))
-		FatalError("Failed to enable TigerVNC devices\n");
-#else /* < 17 */
 	ret = AllocDevicePair(serverClient, "TigerVNC",
 	                      &vncPointerDev, &vncKeyboardDev,
 	                      vncPointerProc, vncKeyboardProc,
@@ -140,21 +103,12 @@
 	if (!EnableDevice(vncPointerDev, TRUE) ||
 	    !EnableDevice(vncKeyboardDev, TRUE))
 		FatalError("Failed to activate TigerVNC devices\n");
-#endif /* 17 */
 
 #if XORG < 111
 	/* eventq is never free()-ed because it exists during server life. */
-	if (eventq == NULL) {
-#if XORG == 15
-		eventq = (xEvent *)xcalloc(sizeof(xEvent),
-					   GetMaximumEventsNum());
-		if (!eventq)
-			FatalError("Couldn't allocate eventq\n");
-#else
+	if (eventq == NULL)
 		GetEventList(&eventq);
 #endif
-	}
-#endif
 
 	vncPrepareInputDevices();
 }
@@ -249,15 +203,7 @@
 		 * good programming practise but in this case it is safe and
 		 * clear.
 		 */
-		mieqEnqueue(dev,
-#if XORG == 15
-			    eventq + i
-#elif XORG == 16
-			    (eventq + i)->event
-#else
-			    (InternalEvent *) (eventq + i)->event
-#endif
-			   );
+		mieqEnqueue(dev, (InternalEvent *) (eventq + i)->event);
 	}
 }
 #endif /* XORG < 111 */
@@ -267,21 +213,18 @@
 	BYTE map[BUTTONS + 1];
 	DevicePtr pDev = (DevicePtr)pDevice;
 	int i;
-#if XORG >= 17
 	/*
 	 * NOTE: map[] array is one element longer than btn_labels[] array. This
 	 * is not a bug.
 	 */
 	Atom btn_labels[BUTTONS];
 	Atom axes_labels[2];
-#endif
 
 	switch (onoff) {
 	case DEVICE_INIT:
 		for (i = 0; i < BUTTONS + 1; i++)
 			map[i] = i;
 
-#if XORG >= 17
 		btn_labels[0] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_LEFT);
 		btn_labels[1] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_MIDDLE);
 		btn_labels[2] = XIGetKnownProperty(BTN_LABEL_PROP_BTN_RIGHT);
@@ -292,20 +235,11 @@
 
 		axes_labels[0] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_X);
 		axes_labels[1] = XIGetKnownProperty(AXIS_LABEL_PROP_REL_Y);
-#endif
 
-		InitPointerDeviceStruct(pDev, map, BUTTONS,
-#if XORG == 15
-					GetMotionHistory,
-#elif XORG >= 17
-					btn_labels,
-#endif
+		InitPointerDeviceStruct(pDev, map, BUTTONS, btn_labels,
 					(PtrCtrlProcPtr)NoopDDA,
-					GetMotionHistorySize(), 2
-#if XORG >= 17
-					, axes_labels
-#endif
-					);
+					GetMotionHistorySize(),
+					2, axes_labels);
 		break;
 	case DEVICE_ON:
 		pDev->on = TRUE;
@@ -330,24 +264,11 @@
 
 static int vncKeyboardProc(DeviceIntPtr pDevice, int onoff)
 {
-#if XORG < 17
-	KeySymsRec keySyms;
-	CARD8 modMap[MAP_LENGTH];
-#endif
 	DevicePtr pDev = (DevicePtr)pDevice;
 
 	switch (onoff) {
 	case DEVICE_INIT:
-#if XORG < 17
-		vncGetInitKeyboardMap(&keySyms, modMap);
-#endif
-		InitKeyboardDeviceStruct(
-#if XORG >= 17
-					 pDevice, NULL,
-#else
-					 pDev, &keySyms, modMap,
-#endif
-					 vncKeyboardBell,
+		InitKeyboardDeviceStruct(pDevice, NULL, vncKeyboardBell,
 					 (KbdCtrlProcPtr)NoopDDA);
 		break;
 	case DEVICE_ON:
diff --git a/unix/xserver/hw/vnc/InputCore.c b/unix/xserver/hw/vnc/InputCore.c
deleted file mode 100644
index 0467766..0000000
--- a/unix/xserver/hw/vnc/InputCore.c
+++ /dev/null
@@ -1,596 +0,0 @@
-/* Copyright (C) 2009 TightVNC Team
- * Copyright (C) 2009 Red Hat, Inc.
- * Copyright 2013-2015 Pierre Ossman for Cendio AB
- *
- * This is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- * 
- * This software is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- * 
- * You should have received a copy of the GNU General Public License
- * along with this software; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307,
- * USA.
- */
-
-#ifdef HAVE_DIX_CONFIG_H
-#include <dix-config.h>
-#endif
-
-#include "Input.h"
-#include "xorg-version.h"
-
-#include "inputstr.h"
-#ifndef XKB_IN_SERVER
-#define XKB_IN_SERVER
-#endif
-#ifdef XKB
-/*
- * This include is needed to use XkbConvertCase instead of XConvertCase even if
- * we don't use XKB extension.
- */
-#include <xkbsrv.h>
-#endif
-/* These defines give us access to all keysyms we need */
-#define XK_PUBLISHING
-#define XK_TECHNICAL
-#include <X11/keysym.h>
-#include <X11/XF86keysym.h>
-#include <X11/Xlib.h>
-#include <X11/Xutil.h>
-
-extern DeviceIntPtr vncKeyboardDev;
-
-#if XORG < 17
-
-#define IS_PRESSED(dev, keycode) \
-	((dev)->key->down[(keycode) >> 3] & (1 << ((keycode) & 7)))
-
-/* Fairly standard US PC Keyboard */
-
-#define MIN_KEY 8
-#define MAX_KEY 255
-#define MAP_LEN (MAX_KEY - MIN_KEY + 1)
-#define KEYSYMS_PER_KEY 2
-static KeySym keyboardMap[MAP_LEN * KEYSYMS_PER_KEY] = {
-	NoSymbol, NoSymbol,
-	XK_Escape, NoSymbol,
-	XK_1, XK_exclam,
-	XK_2, XK_at,
-	XK_3, XK_numbersign,
-	XK_4, XK_dollar,
-	XK_5, XK_percent,
-	XK_6, XK_asciicircum,
-	XK_7, XK_ampersand,
-	XK_8, XK_asterisk,
-	XK_9, XK_parenleft,
-	XK_0, XK_parenright,
-	XK_minus, XK_underscore,
-	XK_equal, XK_plus,
-	XK_BackSpace, NoSymbol,
-	XK_Tab, NoSymbol,
-	XK_q, XK_Q,
-	XK_w, XK_W,
-	XK_e, XK_E,
-	XK_r, XK_R,
-	XK_t, XK_T,
-	XK_y, XK_Y,
-	XK_u, XK_U,
-	XK_i, XK_I,
-	XK_o, XK_O,
-	XK_p, XK_P,
-	XK_bracketleft, XK_braceleft,
-	XK_bracketright, XK_braceright,
-	XK_Return, NoSymbol,
-	XK_Control_L, NoSymbol,
-	XK_a, XK_A,
-	XK_s, XK_S,
-	XK_d, XK_D,
-	XK_f, XK_F,
-	XK_g, XK_G,
-	XK_h, XK_H,
-	XK_j, XK_J,
-	XK_k, XK_K,
-	XK_l, XK_L,
-	XK_semicolon, XK_colon,
-	XK_apostrophe, XK_quotedbl,
-	XK_grave, XK_asciitilde,
-	XK_Shift_L, NoSymbol,
-	XK_backslash, XK_bar,
-	XK_z, XK_Z,
-	XK_x, XK_X,
-	XK_c, XK_C,
-	XK_v, XK_V,
-	XK_b, XK_B,
-	XK_n, XK_N,
-	XK_m, XK_M,
-	XK_comma, XK_less,
-	XK_period, XK_greater,
-	XK_slash, XK_question,
-	XK_Shift_R, NoSymbol,
-	XK_KP_Multiply, NoSymbol,
-	XK_Alt_L, XK_Meta_L,
-	XK_space, NoSymbol,
-	XK_Caps_Lock, NoSymbol,
-	XK_F1, NoSymbol,
-	XK_F2, NoSymbol,
-	XK_F3, NoSymbol,
-	XK_F4, NoSymbol,
-	XK_F5, NoSymbol,
-	XK_F6, NoSymbol,
-	XK_F7, NoSymbol,
-	XK_F8, NoSymbol,
-	XK_F9, NoSymbol,
-	XK_F10, NoSymbol,
-	XK_Num_Lock, XK_Pointer_EnableKeys,
-	XK_Scroll_Lock, NoSymbol,
-	XK_KP_Home, XK_KP_7,
-	XK_KP_Up, XK_KP_8,
-	XK_KP_Prior, XK_KP_9,
-	XK_KP_Subtract, NoSymbol,
-	XK_KP_Left, XK_KP_4,
-	XK_KP_Begin, XK_KP_5,
-	XK_KP_Right, XK_KP_6,
-	XK_KP_Add, NoSymbol,
-	XK_KP_End, XK_KP_1,
-	XK_KP_Down, XK_KP_2,
-	XK_KP_Next, XK_KP_3,
-	XK_KP_Insert, XK_KP_0,
-	XK_KP_Delete, XK_KP_Decimal,
-	NoSymbol, NoSymbol,
-	NoSymbol, NoSymbol,
-	NoSymbol, NoSymbol,
-	XK_F11, NoSymbol,
-	XK_F12, NoSymbol,
-	XK_Home, NoSymbol,
-	XK_Up, NoSymbol,
-	XK_Prior, NoSymbol,
-	XK_Left, NoSymbol,
-	NoSymbol, NoSymbol,
-	XK_Right, NoSymbol,
-	XK_End, NoSymbol,
-	XK_Down, NoSymbol,
-	XK_Next, NoSymbol,
-	XK_Insert, NoSymbol,
-	XK_Delete, NoSymbol,
-	XK_KP_Enter, NoSymbol,
-	XK_Control_R, NoSymbol,
-	XK_Pause, XK_Break,
-	XK_Print, XK_Execute,
-	XK_KP_Divide, NoSymbol,
-	XK_Alt_R, XK_Meta_R,
-	NoSymbol, NoSymbol,
-	XK_Super_L, NoSymbol,
-	XK_Super_R, NoSymbol,
-	XK_Menu, NoSymbol,
-};
-
-void vncGetInitKeyboardMap(KeySymsPtr keysyms, CARD8 *modmap)
-{
-	int i;
-
-	for (i = 0; i < MAP_LENGTH; i++)
-		modmap[i] = NoSymbol;
-
-	for (i = 0; i < MAP_LEN; i++) {
-		switch (keyboardMap[i * KEYSYMS_PER_KEY]) {
-		case XK_Shift_L:
-		case XK_Shift_R:
-			modmap[i + MIN_KEY] = ShiftMask;
-			break;
-		case XK_Caps_Lock:
-			modmap[i + MIN_KEY] = LockMask;
-			break;
-		case XK_Control_L:
-		case XK_Control_R:
-			modmap[i + MIN_KEY] = ControlMask;
-			break;
-		case XK_Alt_L:
-		case XK_Alt_R:
-			modmap[i + MIN_KEY] = Mod1Mask;
-			break;
-		case XK_Num_Lock:
-			modmap[i + MIN_KEY] = Mod2Mask;
-			break;
-			/* No defaults for Mod3Mask yet */
-		case XK_Super_L:
-		case XK_Super_R:
-		case XK_Hyper_L:
-		case XK_Hyper_R:
-			modmap[i + MIN_KEY] = Mod4Mask;
-			break;
-		case XK_ISO_Level3_Shift:
-		case XK_Mode_switch:
-			modmap[i + MIN_KEY] = Mod5Mask;
-			break;
-		}
-	}
-
-	keysyms->minKeyCode = MIN_KEY;
-	keysyms->maxKeyCode = MAX_KEY;
-	keysyms->mapWidth = KEYSYMS_PER_KEY;
-	keysyms->map = keyboardMap;
-}
-
-void vncPrepareInputDevices(void)
-{
-	/* Don't need to do anything here */
-}
-
-unsigned vncGetKeyboardState(void)
-{
-	return vncKeyboardDev->key->state;
-}
-
-unsigned vncGetLevelThreeMask(void)
-{
-	int i, j, k;
-
-	int minKeyCode, mapWidth;
-	KeySym *map;
-
-	int maxKeysPerMod;
-	CARD8 *modmap;
-
-	minKeyCode = vncKeyboardDev->key->curKeySyms.minKeyCode;
-	mapWidth = vncKeyboardDev->key->curKeySyms.mapWidth;
-	map = vncKeyboardDev->key->curKeySyms.map;
-
-	maxKeysPerMod = vncKeyboardDev->key->maxKeysPerModifier;
-	modmap = vncKeyboardDev->key->modifierKeyMap;
-
-	for (i = 3; 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++) {
-				KeySym keysym;
-				keysym = map[(keycode - minKeyCode) * mapWidth + j];
-				if (keysym == XK_Mode_switch)
-					return 1 << i;
-			}
-		}
-	}
-
-	return 0;
-}
-
-KeyCode vncPressShift(void)
-{
-	int maxKeysPerMod;
-
-	maxKeysPerMod = vncKeyboardDev->key->maxKeysPerModifier;
-	return vncKeyboardDev->key->modifierKeyMap[ShiftMapIndex * maxKeysPerMod];
-}
-
-size_t vncReleaseShift(KeyCode *keys, size_t maxKeys)
-{
-	size_t count;
-	int maxKeysPerMod;
-
-	count = 0;
-	maxKeysPerMod = vncKeyboardDev->key->maxKeysPerModifier;
-	for (int k = 0; k < maxKeysPerMod; k++) {
-		int keycode;
-		int index;
-
-		index = ShiftMapIndex * maxKeysPerMod + k;
-
-		keycode = vncKeyboardDev->key->modifierKeyMap[index];
-		if (keycode == 0)
-			continue;
-
-		if (!IS_PRESSED(vncKeyboardDev, keycode))
-			continue;
-
-		if (count >= maxKeys)
-			return 0;
-
-		keys[count++] = keycode;
-	}
-
-	return count;
-}
-
-KeyCode vncPressLevelThree(void)
-{
-	unsigned mask, index;
-	int maxKeysPerMod;
-
-	mask = getLevelThreeMask();
-	if (mask == 0)
-		return 0;
-
-	index = ffs(mask) - 1;
-	maxKeysPerMod = vncKeyboardDev->key->maxKeysPerModifier;
-	return vncKeyboardDev->key->modifierKeyMap[index * maxKeysPerMod];
-}
-
-size_t vncReleaseLevelThree(KeyCode *keys, size_t maxKeys)
-{
-	size_t count;
-	unsigned mask, msindex;
-	int maxKeysPerMod;
-
-	mask = getLevelThreeMask();
-	if (mask == 0)
-		return 0;
-
-	msindex = ffs(mask) - 1;
-
-	count = 0;
-	maxKeysPerMod = vncKeyboardDev->key->maxKeysPerModifier;
-	for (int k = 0; k < maxKeysPerMod; k++) {
-		int keycode;
-		int index;
-
-		index = msindex * maxKeysPerMod + k;
-
-		keycode = vncKeyboardDev->key->modifierKeyMap[index];
-		if (keycode == 0)
-			continue;
-
-		if (!IS_PRESSED(vncKeyboardDev, keycode))
-			continue;
-
-		if (count >= maxKeys)
-			return 0;
-
-		keys[count++] = keycode;
-	}
-
-	return count;
-}
-
-static KeySym KeyCodetoKeySym(KeySymsPtr keymap, int keycode, int col)
-{
-	int per = keymap->mapWidth;
-	KeySym *syms;
-	KeySym lsym, usym;
-
-	if ((col < 0) || ((col >= per) && (col > 3)) ||
-	    (keycode < keymap->minKeyCode) || (keycode > keymap->maxKeyCode))
-		return NoSymbol;
-
-	syms = &keymap->map[(keycode - keymap->minKeyCode) * per];
-	if (col >= 4)
-		return syms[col];
-
-	if (col > 1) {
-		while ((per > 2) && (syms[per - 1] == NoSymbol))
-			per--;
-		if (per < 3)
-			col -= 2;
-	}
-
-	if ((per <= (col|1)) || (syms[col|1] == NoSymbol)) {
-		XkbConvertCase(syms[col&~1], &lsym, &usym);
-		if (!(col & 1))
-			return lsym;
-		/*
-		 * I'm commenting out this logic because it's incorrect even
-		 * though it was copied from the Xlib sources.  The X protocol
-		 * book quite clearly states that where a group consists of
-		 * element 1 being a non-alphabetic keysym and element 2 being
-		 * NoSymbol that you treat the second element as being the
-		 * same as the first.  This also tallies with the behaviour
-		 * produced by the installed Xlib on my linux box (I believe
-		 * this is because it uses some XKB code rather than the
-		 * original Xlib code - compare XKBBind.c with KeyBind.c in
-		 * lib/X11).
-		 */
-#if 0
-		else if (usym == lsym)
-			return NoSymbol;
-#endif
-		else
-			return usym;
-	}
-
-	return syms[col];
-}
-
-KeyCode vncKeysymToKeycode(KeySym keysym, unsigned state, unsigned *new_state)
-{
-	int i, j;
-	unsigned mask;
-
-	KeySymsPtr keymap;
-	int mapWidth;
-
-	mask = vncGetLevelThreeMask();
-
-	keymap = &vncKeyboardDev->key->curKeySyms;
-
-	/*
-	 * Column 0 means both shift and "mode_switch" (AltGr) must be released,
-	 * column 1 means shift must be pressed and mode_switch released,
-	 * column 2 means shift must be released and mode_switch pressed, and
-	 * column 3 means both shift and mode_switch must be pressed.
-	 */
-	j = 0;
-	if (state & ShiftMask)
-		j |= 0x1;
-	if (state & mask)
-		j |= 0x2;
-
-	*new_state = state;
-	for (i = keymap->minKeyCode; i <= keymap->maxKeyCode; i++) {
-		if (KeyCodetoKeySym(keymap, i, j) == keysym)
-			return i;
-	}
-
-	/* Only the first four columns have well-defined meaning */
-	mapWidth = keymap->mapWidth;
-	if (mapWidth > 4)
-		mapWidth = 4;
-
-	for (j = 0; j < mapWidth; j++) {
-		for (i = keymap->minKeyCode; i <= keymap->maxKeyCode; i++) {
-			if (KeyCodetoKeySym(keymap, i, j) == keysym) {
-				*new_state = state & ~(ShiftMask|mask);
-				if (j & 0x1)
-					*new_state |= ShiftMask;
-				if (j & 0x2)
-					*new_state |= mask;
-
-				return i;
-			}
-		}
-	}
-
-	return 0;
-}
-
-int vncIsLockModifier(KeyCode keycode, unsigned state)
-{
-	int i, j, k;
-
-	int minKeyCode, mapWidth;
-	KeySym *map;
-
-	int maxKeysPerMod;
-	CARD8 *modmap;
-
-	int num_lock_index;
-
-	minKeyCode = vncKeyboardDev->key->curKeySyms.minKeyCode;
-	mapWidth = vncKeyboardDev->key->curKeySyms.mapWidth;
-	map = vncKeyboardDev->key->curKeySyms.map;
-
-	maxKeysPerMod = vncKeyboardDev->key->maxKeysPerModifier;
-	modmap = vncKeyboardDev->key->modifierKeyMap;
-
-	/* Caps Lock is fairly easy as it has a dedicated modmap entry */
-	for (k = 0; k < maxKeysPerMod; k++) {
-		int index;
-
-		index = LockMapIndex * maxKeysPerMod + k;
-		if (keycode == modmap[index])
-			return 1;
-	}
-
-	/* For Num Lock we need to find the correct modmap entry */
-	num_lock_index = i;
-	for (i = 3; 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++) {
-				KeySym keysym;
-				keysym = map[(keycode - minKeyCode) * mapWidth + j];
-				if (keysym == XK_Num_Lock) {
-					num_lock_index = i;
-					goto done;
-				}
-			}
-		}
-	}
-done:
-
-	if (num_lock_index == 0)
-		return 0;
-
-	/* Now we can look in the modmap */ 
-	for (k = 0; k < maxKeysPerMod; k++) {
-		int index;
-
-		index = num_lock_index * maxKeysPerMod + k;
-		if (keycode == modmap[index])
-			return 1;
-	}
-
-	return 0;
-}
-
-int vncIsAffectedByNumLock(KeyCode keycode)
-{
-	KeySymsPtr keymap;
-	int i, per;
-	KeySym *syms;
-
-	keymap = &vncKeyboardDev->key->curKeySyms;
-	per = keymap->mapWidth;
-	syms = &keymap->map[(keycode - keymap->minKeyCode) * per];
-
-	for (i = 0;i < per;i++) {
-		if (IsKeypadKey(syms[i]))
-			return 1;
-		if (IsPrivateKeypadKey(syms[i]))
-			return 1;
-	}
-
-	return 0;
-}
-
-KeyCode vncAddKeysym(KeySym keysym, unsigned state)
-{
-	KeyCode kc;
-
-	int minKeyCode, maxKeyCode, mapWidth;
-	KeySym *map;
-
-	minKeyCode = vncKeyboardDev->key->curKeySyms.minKeyCode;
-	maxKeyCode = vncKeyboardDev->key->curKeySyms.maxKeyCode;
-	mapWidth = vncKeyboardDev->key->curKeySyms.mapWidth;
-	map = vncKeyboardDev->key->curKeySyms.map;
-
-	/*
-	 * Magic, which dynamically adds keysym<->keycode mapping
-	 * depends on X.Org version. Quick explanation of that "magic":
-	 * 
-	 * 1.5
-	 * - has only one core keyboard so we have to keep core
-	 *   keyboard mapping synchronized with vncKeyboardDevice. Do
-	 *   it via SwitchCoreKeyboard()
-	 *
-	 * 1.6 (aka MPX - Multi pointer X)
-	 * - multiple master devices (= core devices) exists, keep
-	 *   vncKeyboardDevice synchronized with proper master device
-	 */
-	for (kc = maxKeyCode; kc >= minKeyCode; kc--) {
-		DeviceIntPtr master;
-
-		if (map[(kc - minKeyCode) * mapWidth] != 0)
-			continue;
-
-		map[(kc - minKeyCode) * mapWidth] = keysym;
-
-#if XORG == 15
-		master = inputInfo.keyboard;
-#else
-		master = vncKeyboardDev->u.master;
-#endif
-		void *slave = dixLookupPrivate(&master->devPrivates,
-					       CoreDevicePrivateKey);
-		if (vncKeyboardDev == slave) {
-			dixSetPrivate(&master->devPrivates,
-				      CoreDevicePrivateKey, NULL);
-#if XORG == 15
-			SwitchCoreKeyboard(vncKeyboardDev);
-#else
-			CopyKeyClass(vncKeyboardDev, master);
-#endif
-		}
-
-		return kc;
-	}
-
-	return 0;
-}
-
-#endif
-
diff --git a/unix/xserver/hw/vnc/InputXKB.c b/unix/xserver/hw/vnc/InputXKB.c
index e639d5e..8d7488a 100644
--- a/unix/xserver/hw/vnc/InputXKB.c
+++ b/unix/xserver/hw/vnc/InputXKB.c
@@ -24,8 +24,6 @@
 
 #include "xorg-version.h"
 
-#if XORG >= 17
-
 #include <stdio.h>
 
 #include <X11/keysym.h>
@@ -658,5 +656,3 @@
 		ctrls->enabled_ctrls = backupctrls;
 	}
 }
-
-#endif /* XORG >= 117 */
diff --git a/unix/xserver/hw/vnc/Makefile.am b/unix/xserver/hw/vnc/Makefile.am
index 902aabf..8f9b0f4 100644
--- a/unix/xserver/hw/vnc/Makefile.am
+++ b/unix/xserver/hw/vnc/Makefile.am
@@ -16,7 +16,7 @@
 
 libvnccommon_la_SOURCES = $(HDRS) vncExt.c vncExtInit.cc vncHooks.c \
 	vncBlockHandler.c XorgGlue.c RFBGlue.cc XserverDesktop.cc \
-	Input.c InputCore.c InputXKB.c
+	Input.c InputXKB.c
 
 libvnccommon_la_CPPFLAGS = -DVENDOR_RELEASE="$(VENDOR_RELEASE)" \
 	-DVENDOR_STRING="\"$(VENDOR_STRING)\"" -I$(TIGERVNC_SRCDIR)/common -UHAVE_CONFIG_H \
diff --git a/unix/xserver/hw/vnc/vncHooks.c b/unix/xserver/hw/vnc/vncHooks.c
index dc2b811..5867aa0 100644
--- a/unix/xserver/hw/vnc/vncHooks.c
+++ b/unix/xserver/hw/vnc/vncHooks.c
@@ -96,10 +96,7 @@
 #endif
 } vncHooksGCRec, *vncHooksGCPtr;
 
-#if XORG == 15
-static DevPrivateKey vncHooksScreenPrivateKey = &vncHooksScreenPrivateKey;
-static DevPrivateKey vncHooksGCPrivateKey = &vncHooksGCPrivateKey;
-#elif XORG < 19
+#if XORG < 19
 static int vncHooksScreenPrivateKeyIndex;
 static int vncHooksGCPrivateKeyIndex;
 static DevPrivateKey vncHooksScreenPrivateKey = &vncHooksScreenPrivateKeyIndex;
@@ -133,11 +130,8 @@
 #if XORG < 110
 static RegionPtr vncHooksRestoreAreas(WindowPtr pWin, RegionPtr prgnExposed);
 #endif
-static Bool vncHooksDisplayCursor(
-#if XORG >= 16
-				  DeviceIntPtr pDev,
-#endif
-				  ScreenPtr pScreen, CursorPtr cursor);
+static Bool vncHooksDisplayCursor(DeviceIntPtr pDev,
+                                  ScreenPtr pScreen, CursorPtr cursor);
 #if XORG <= 112
 static void vncHooksBlockHandler(int i, pointer blockData, pointer pTimeout,
                                  pointer pReadmask);
@@ -601,30 +595,20 @@
 
 // DisplayCursor - get the cursor shape
 
-static Bool vncHooksDisplayCursor(
-#if XORG >= 16
-				  DeviceIntPtr pDev,
-#endif
-				  ScreenPtr pScreen_, CursorPtr cursor)
+static Bool vncHooksDisplayCursor(DeviceIntPtr pDev,
+                                  ScreenPtr pScreen_, CursorPtr cursor)
 {
   Bool ret;
 
   SCREEN_UNWRAP(pScreen_, DisplayCursor);
 
-  ret = (*pScreen->DisplayCursor) (
-#if XORG >= 16
-					pDev,
-#endif
-					pScreen, cursor);
+  ret = (*pScreen->DisplayCursor) (pDev, pScreen, cursor);
 
-#if XORG >= 16
   /*
    * XXX DIX calls this function with NULL argument to remove cursor sprite from
    * screen. Should we handle this in setCursor as well?
    */
-  if (cursor != NullCursor)
-#endif
-  {
+  if (cursor != NullCursor) {
     int width, height;
     int hotX, hotY;
 
diff --git a/unix/xserver/hw/vnc/xvnc.c b/unix/xserver/hw/vnc/xvnc.c
index 3498d0f..1f99107 100644
--- a/unix/xserver/hw/vnc/xvnc.c
+++ b/unix/xserver/hw/vnc/xvnc.c
@@ -75,11 +75,9 @@
 #endif /* RANDR */
 #include <X11/keysym.h>
   extern char buildtime[];
-#if XORG >= 17
 #undef VENDOR_RELEASE
 #undef VENDOR_STRING
 #include "version-config.h"
-#endif
 #include "site.h"
 
 #if XORG >= 110
@@ -833,39 +831,28 @@
 {
 }
 
-static Bool vfbRealizeCursor(
-#if XORG >= 16
-			     DeviceIntPtr pDev,
-#endif
-			     ScreenPtr pScreen, CursorPtr pCursor) {
+static Bool vfbRealizeCursor(DeviceIntPtr pDev,
+                             ScreenPtr pScreen, CursorPtr pCursor)
+{
     return TRUE;
 }
 
-static Bool vfbUnrealizeCursor(
-#if XORG >= 16
-			       DeviceIntPtr pDev,
-#endif
-			       ScreenPtr pScreen, CursorPtr pCursor) {
+static Bool vfbUnrealizeCursor(DeviceIntPtr pDev,
+                               ScreenPtr pScreen, CursorPtr pCursor)
+{
     return TRUE;
 }
 
-static void vfbSetCursor(
-#if XORG >= 16
-			 DeviceIntPtr pDev,
-#endif
-			 ScreenPtr pScreen, CursorPtr pCursor, int x, int y) 
+static void vfbSetCursor(DeviceIntPtr pDev,
+                         ScreenPtr pScreen, CursorPtr pCursor, int x, int y) 
 {
 }
 
-static void vfbMoveCursor(
-#if XORG >= 16
-			  DeviceIntPtr pDev,
-#endif
-			  ScreenPtr pScreen, int x, int y) 
+static void vfbMoveCursor(DeviceIntPtr pDev,
+                          ScreenPtr pScreen, int x, int y) 
 {
 }
 
-#if XORG >= 16
 static Bool
 vfbDeviceCursorInitialize(DeviceIntPtr pDev, ScreenPtr pScreen)
 {   
@@ -876,17 +863,14 @@
 vfbDeviceCursorCleanup(DeviceIntPtr pDev, ScreenPtr pScreen)
 { 
 }
-#endif
 
 static miPointerSpriteFuncRec vfbPointerSpriteFuncs = {
     vfbRealizeCursor,
     vfbUnrealizeCursor,
     vfbSetCursor,
-    vfbMoveCursor
-#if XORG >= 16
-    , vfbDeviceCursorInitialize,
+    vfbMoveCursor,
+    vfbDeviceCursorInitialize,
     vfbDeviceCursorCleanup
-#endif
 };
 
 static miPointerScreenFuncRec vfbPointerCursorFuncs = {
@@ -1206,11 +1190,7 @@
     }
 
     /* Let RandR know we approve, and let it update its internal state */
-    ret = RRCrtcNotify(crtc, mode, x, y, rotation,
-#if XORG >= 16
-                       NULL,
-#endif
-                       num_outputs, outputs);
+    ret = RRCrtcNotify(crtc, mode, x, y, rotation, NULL, num_outputs, outputs);
     if (!ret)
         return FALSE;
 
@@ -1672,9 +1652,6 @@
 void ProcessInputEvents()
 {
   mieqProcessInputEvents();
-#if XORG == 15
-  miPointerUpdate();
-#endif
 }
 
 // InitInput is called after InitExtensions, so we're guaranteed that