From 5c6e64113d8ed7877d777fe6509c4566d48f2656 Mon Sep 17 00:00:00 2001 From: Pierre Ossman Date: Mon, 14 Jul 2014 13:46:48 +0200 Subject: [PATCH] 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. --- unix/xserver/hw/vnc/Input.cc | 10 +++++----- unix/xserver/hw/vnc/Input.h | 1 - 2 files changed, 5 insertions(+), 6 deletions(-) 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; -- 2.39.5