From: Pierre Ossman Date: Mon, 14 Jul 2014 11:46:48 +0000 (+0200) Subject: Handle closing of input devices X-Git-Tag: v1.3.90~46^2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=refs%2Fpull%2F6%2Fhead;p=tigervnc.git Handle closing of input devices The core can decide to close an input device (e.g. during a server reset). Make sure we respect this by forgetting about the device and recreating it again later. --- diff --git a/unix/xserver/hw/vnc/Input.cc b/unix/xserver/hw/vnc/Input.cc index 1d875746..28b84c71 100644 --- a/unix/xserver/hw/vnc/Input.cc +++ b/unix/xserver/hw/vnc/Input.cc @@ -256,10 +256,9 @@ int InputDevice::pointerProc(DeviceIntPtr pDevice, int onoff) case DEVICE_OFF: pDev->on = FALSE; break; -#if 0 case DEVICE_CLOSE: + singleton.pointerDev = NULL; break; -#endif } return Success; @@ -299,6 +298,9 @@ int InputDevice::keyboardProc(DeviceIntPtr pDevice, int onoff) case DEVICE_OFF: pDev->on = FALSE; break; + case DEVICE_CLOSE: + singleton.keyboardDev = NULL; + break; } return Success; @@ -306,11 +308,9 @@ int InputDevice::keyboardProc(DeviceIntPtr pDevice, int onoff) void InputDevice::InitInputDevice(void) { - if (initialized) + if ((pointerDev != NULL) || (keyboardDev != NULL)) return; - initialized = true; - #if XORG < 17 pointerDev = AddInputDevice( #if XORG >= 16 diff --git a/unix/xserver/hw/vnc/Input.h b/unix/xserver/hw/vnc/Input.h index 029b80d1..90b392cf 100644 --- a/unix/xserver/hw/vnc/Input.h +++ b/unix/xserver/hw/vnc/Input.h @@ -116,7 +116,6 @@ private: #endif private: - bool initialized; DeviceIntPtr keyboardDev; DeviceIntPtr pointerDev;