diff options
author | Pierre Ossman <ossman@cendio.se> | 2014-07-14 13:41:36 +0200 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2014-07-14 13:41:36 +0200 |
commit | de0b3532320e088440bd7607f7d5d7e8fc720d94 (patch) | |
tree | b8e9ff8acc2b0d81e1ef55d4255a6abfe8792655 /unix/xserver/hw/vnc/Input.h | |
parent | 8c8f85034b15d7d2a1589378f9d0ee236a98a3c8 (diff) | |
download | tigervnc-de0b3532320e088440bd7607f7d5d7e8fc720d94.tar.gz tigervnc-de0b3532320e088440bd7607f7d5d7e8fc720d94.zip |
Make InputDevice into a singleton
Xorg input devices are global so it doesn't make sense that we
have one InputDevice object per XserverDesktop.
Diffstat (limited to 'unix/xserver/hw/vnc/Input.h')
-rw-r--r-- | unix/xserver/hw/vnc/Input.h | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/unix/xserver/hw/vnc/Input.h b/unix/xserver/hw/vnc/Input.h index 8a3dd4f2..029b80d1 100644 --- a/unix/xserver/hw/vnc/Input.h +++ b/unix/xserver/hw/vnc/Input.h @@ -40,12 +40,16 @@ extern "C" { #include "xorg-version.h" -/* Represents input device (keyboard + pointer) */ +/* + * Represents input device (keyboard + pointer) + * + * Is a singleton as input devices are global in the X server so + * we do not have one per desktop (i.e. per screen). + */ +extern class InputDevice *vncInputDevice; + class InputDevice { public: - /* Create new InputDevice instance */ - InputDevice(); - /* * Press or release buttons. Relationship between buttonMask and * buttons is specified in RFB protocol. @@ -63,17 +67,20 @@ public: void KeyboardRelease(rdr::U32 keysym) { keyEvent(keysym, false); } /* - * Init input device. This cannot be done in the constructor - * because constructor is called during X server extensions - * initialization. Devices must be initialized after core - * pointer/keyboard initialization which is actually after extesions - * initialization. Check InitExtensions(), InitCoreDevices() and - * InitInput() calls in dix/main.c. Instead it is called from - * XserverDesktop at an appropriate time. + * Init input device. + * This has to be called after core pointer/keyboard + * initialization which unfortunately is after extesions + * initialization (which means we cannot call it in + * vncExtensionInit(). Check InitExtensions(), + * InitCoreDevices() and InitInput() calls in dix/main.c. + * Instead we call it from XserverDesktop at an appropriate + * time. */ void InitInputDevice(void); private: + InputDevice(); + void keyEvent(rdr::U32 keysym, bool down); /* Backend dependent functions below here */ @@ -117,6 +124,9 @@ private: rfb::Point cursorPos; KeySym pressedKeys[256]; + +private: + static InputDevice singleton; }; #endif |