diff options
author | Pierre Ossman <ossman@cendio.se> | 2021-12-14 12:26:56 +0100 |
---|---|---|
committer | Pierre Ossman <ossman@cendio.se> | 2024-12-04 17:01:19 +0100 |
commit | 7e7e05075bccece85efa92f14f516c065a8fa531 (patch) | |
tree | fa36b849e991fdb5c24de6c4fc8bf208d96293cd /vncviewer/Keyboard.h | |
parent | 245c5421323966a87e8d6d70e391bef0d85b2e65 (diff) | |
download | tigervnc-7e7e05075bccece85efa92f14f516c065a8fa531.tar.gz tigervnc-7e7e05075bccece85efa92f14f516c065a8fa531.zip |
Move keyboard handling to separate classes
Encapsulate all the platform specific magic around keyboard in to
specific classes, in order to keep the core code more readable.
Diffstat (limited to 'vncviewer/Keyboard.h')
-rw-r--r-- | vncviewer/Keyboard.h | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/vncviewer/Keyboard.h b/vncviewer/Keyboard.h new file mode 100644 index 00000000..81360252 --- /dev/null +++ b/vncviewer/Keyboard.h @@ -0,0 +1,49 @@ +/* Copyright 2011-2021 Pierre Ossman <ossman@cendio.se> 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. + */ + +#ifndef __KEYBOARD_H__ +#define __KEYBOARD_H__ + +#include <stdint.h> + +class KeyboardHandler +{ +public: + virtual void handleKeyPress(int systemKeyCode, + uint32_t keyCode, uint32_t keySym) = 0; + virtual void handleKeyRelease(int systemKeyCode) = 0; +}; + +class Keyboard +{ +public: + Keyboard(KeyboardHandler* handler_) : handler(handler_) {}; + virtual ~Keyboard() {}; + + virtual bool handleEvent(const void* event) = 0; + + virtual void reset() {}; + + virtual unsigned getLEDState() = 0; + virtual void setLEDState(unsigned state) = 0; + +protected: + KeyboardHandler* handler; +}; + +#endif |