From f17bc9a0ddf0ff26a5260c956218a84ec0a80e73 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Tue, 9 Apr 2013 15:53:47 +0000 Subject: Move keyboardProc() so we have all the init stuff in one place. git-svn-id: svn://svn.code.sf.net/p/tigervnc/code/trunk@5076 3789f03b-4d11-0410-bbf8-ca57d06f2519 --- unix/xserver/hw/vnc/Input.cc | 88 +++++++++++++++++++++----------------------- 1 file changed, 41 insertions(+), 47 deletions(-) diff --git a/unix/xserver/hw/vnc/Input.cc b/unix/xserver/hw/vnc/Input.cc index 83a9e885..d36a4d76 100644 --- a/unix/xserver/hw/vnc/Input.cc +++ b/unix/xserver/hw/vnc/Input.cc @@ -64,9 +64,6 @@ using namespace rfb; static LogWriter vlog("Input"); #define BUTTONS 7 -static int pointerProc(DeviceIntPtr pDevice, int onoff); - -static int keyboardProc(DeviceIntPtr pDevice, int onoff); /* Event queue is shared between all devices. */ #if XORG == 15 @@ -262,6 +259,47 @@ static int pointerProc(DeviceIntPtr pDevice, int onoff) return Success; } +static void keyboardBell(int percent, DeviceIntPtr device, pointer ctrl, + int class_) +{ + if (percent > 0) + vncBell(); +} + +extern void GetInitKeyboardMap(KeySymsPtr keysyms, CARD8 *modmap); + +static int keyboardProc(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 + GetInitKeyboardMap(&keySyms, modMap); +#endif + InitKeyboardDeviceStruct( +#if XORG >= 17 + pDevice, NULL, +#else + pDev, &keySyms, modMap, +#endif + keyboardBell, (KbdCtrlProcPtr)NoopDDA); + break; + case DEVICE_ON: + pDev->on = TRUE; + break; + case DEVICE_OFF: + pDev->on = FALSE; + break; + } + + return Success; +} + void InputDevice::InitInputDevice(void) { if (initialized) @@ -568,47 +606,3 @@ void InputDevice::keyEvent(rdr::U32 keysym, bool down) */ mieqProcessInputEvents(); } - -static void keyboardBell(int percent, DeviceIntPtr device, pointer ctrl, - int class_) -{ - if (percent > 0) - vncBell(); -} - -static int keyboardProc(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 - GetMappings(&keySyms, modMap); -#endif - InitKeyboardDeviceStruct( -#if XORG >= 17 - pDevice, NULL, -#else - pDev, &keySyms, modMap, -#endif - keyboardBell, (KbdCtrlProcPtr)NoopDDA); - break; - case DEVICE_ON: - pDev->on = TRUE; - break; - case DEVICE_OFF: - pDev->on = FALSE; - break; -#if 0 - case DEVICE_CLOSE: - break; -#endif - } - - return Success; -} - -- cgit v1.2.3