deskflow/src/lib/platform/XWindowsScreen.h

251 lines
6.8 KiB
C
Raw Normal View History

2012-06-10 16:50:54 +00:00
/*
* Deskflow -- mouse and keyboard sharing utility
* SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
* SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
2012-06-10 16:50:54 +00:00
*/
#pragma once
#include "arch/Arch.h"
#include "common/stdset.h"
#include "common/stdvector.h"
#include "deskflow/ClientArgs.h"
#include "deskflow/KeyMap.h"
#include "deskflow/PlatformScreen.h"
#include "platform/XWindowsPowerManager.h"
2012-06-10 16:50:54 +00:00
#if X_DISPLAY_MISSING
#error X11 is required to build deskflow
2012-06-10 16:50:54 +00:00
#else
#include <X11/Xlib.h>
2012-06-10 16:50:54 +00:00
#endif
2014-11-12 11:28:41 +00:00
class XWindowsClipboard;
class XWindowsKeyState;
class XWindowsScreenSaver;
2012-06-10 16:50:54 +00:00
//! Implementation of IPlatformScreen for X11
class XWindowsScreen : public PlatformScreen
{
2012-06-10 16:50:54 +00:00
public:
XWindowsScreen(
const char *displayName, bool isPrimary, bool disableXInitThreads, int mouseScrollDelta, IEventQueue *events,
deskflow::ClientScrollDirection m_clientScrollDirection = deskflow::ClientScrollDirection::SERVER
);
FreeBSD GitHub runner with `vmactions/freebsd-vm@v1` (#7474) * Add experimental BSD job to CI * Remove container * cd into ` synergy/synergy/` * Change unix to bsd * Use only run param and not prepare * Install python3 on FreeBSD * Add missing command to prepare param * Add all the Unix-like BSD-derived * Use latest python3 for NetBSD and DragonFly BSD * Use env for cmd and correct prepare commands * Add deps config for unix-like * Install Python deps on Unix-like * Return matching entry in `get_unix_like_os` * Add cmake dep for cmakelang py module * Back out Unix-like support in `install_deps.py` (Python is tricky on BSD) * Back out BSD from config * Create install_deps.sh script for BSD-derived * Use .sh script instead of .py for BSD-derived * Add other case and fixed syntax * Use /usr/bin/env * Use more available sh * Restore debian command * Fixed syntax error * Remove prepare args * Remove space * Use which instead of command * Add libX11 dep * Add other BSD-derivatives * Set CMAKE_REQUIRED_INCLUDES * Fixed bad separator for CMAKE_REQUIRED_INCLUDES * Add debug lines * Set CMAKE_REQUIRED_LIBRARIES to lib names * use CMAKE_REQUIRED_QUIET * Set CMAKE_REQUIRED_FLAGS for BSD * Message for BSD packaging * Make PKG_CONFIG_FOUND optional * Move debug to all OS * Remove solaris for now, too many missing packages * Add missing override to XWindowsScreen.h * Add PC_GLIB_INCLUDE_DIRS * Fixed glib include * Make libnotify optional * Set CMAKE_LIBRARY_PATH * Only run tests if toml++ available * Also run integ tests * Remove DragonFly (C++ version too old) * Fixed NetBSD command * Aww sucks. Well, I tried. Patches welcome * Update ChangeLog * Fixed README for OpenBSD, NetBSD, DragonFly BSD, Solaris * Add missing case for SunOS * Drop redundant virtual specifiers * Print libs on FreeBSD * Restore link_directories * Beef up to ubuntu-24.04-16-core-x64, export QT_QPA_PLATFORM, improve comment * Remove debug line * Simplify debug text * Restore ubuntu-latest * Fixed really stupid typo * Beef up with ubuntu-22.04-16-core-x64 * Revert "Beef up with ubuntu-22.04-16-core-x64" This reverts commit 3de5773ef6c6eea99b93d3ee8448b0b95dc00dde. * Add missing name * Make .sh file primary deps file * Tweaked deps instruction label
2024-09-06 09:03:34 +00:00
virtual ~XWindowsScreen() override;
//! @name manipulators
//@{
//@}
// IScreen overrides
FreeBSD GitHub runner with `vmactions/freebsd-vm@v1` (#7474) * Add experimental BSD job to CI * Remove container * cd into ` synergy/synergy/` * Change unix to bsd * Use only run param and not prepare * Install python3 on FreeBSD * Add missing command to prepare param * Add all the Unix-like BSD-derived * Use latest python3 for NetBSD and DragonFly BSD * Use env for cmd and correct prepare commands * Add deps config for unix-like * Install Python deps on Unix-like * Return matching entry in `get_unix_like_os` * Add cmake dep for cmakelang py module * Back out Unix-like support in `install_deps.py` (Python is tricky on BSD) * Back out BSD from config * Create install_deps.sh script for BSD-derived * Use .sh script instead of .py for BSD-derived * Add other case and fixed syntax * Use /usr/bin/env * Use more available sh * Restore debian command * Fixed syntax error * Remove prepare args * Remove space * Use which instead of command * Add libX11 dep * Add other BSD-derivatives * Set CMAKE_REQUIRED_INCLUDES * Fixed bad separator for CMAKE_REQUIRED_INCLUDES * Add debug lines * Set CMAKE_REQUIRED_LIBRARIES to lib names * use CMAKE_REQUIRED_QUIET * Set CMAKE_REQUIRED_FLAGS for BSD * Message for BSD packaging * Make PKG_CONFIG_FOUND optional * Move debug to all OS * Remove solaris for now, too many missing packages * Add missing override to XWindowsScreen.h * Add PC_GLIB_INCLUDE_DIRS * Fixed glib include * Make libnotify optional * Set CMAKE_LIBRARY_PATH * Only run tests if toml++ available * Also run integ tests * Remove DragonFly (C++ version too old) * Fixed NetBSD command * Aww sucks. Well, I tried. Patches welcome * Update ChangeLog * Fixed README for OpenBSD, NetBSD, DragonFly BSD, Solaris * Add missing case for SunOS * Drop redundant virtual specifiers * Print libs on FreeBSD * Restore link_directories * Beef up to ubuntu-24.04-16-core-x64, export QT_QPA_PLATFORM, improve comment * Remove debug line * Simplify debug text * Restore ubuntu-latest * Fixed really stupid typo * Beef up with ubuntu-22.04-16-core-x64 * Revert "Beef up with ubuntu-22.04-16-core-x64" This reverts commit 3de5773ef6c6eea99b93d3ee8448b0b95dc00dde. * Add missing name * Make .sh file primary deps file * Tweaked deps instruction label
2024-09-06 09:03:34 +00:00
void *getEventTarget() const override;
bool getClipboard(ClipboardID id, IClipboard *) const override;
2025-01-11 01:11:56 +00:00
void getShape(int32_t &x, int32_t &y, int32_t &width, int32_t &height) const override;
void getCursorPos(int32_t &x, int32_t &y) const override;
// IPrimaryScreen overrides
2025-01-11 02:13:19 +00:00
void reconfigure(uint32_t activeSides) override;
2025-01-11 01:11:56 +00:00
void warpCursor(int32_t x, int32_t y) override;
2025-01-11 02:13:19 +00:00
uint32_t registerHotKey(KeyID key, KeyModifierMask mask) override;
void unregisterHotKey(uint32_t id) override;
FreeBSD GitHub runner with `vmactions/freebsd-vm@v1` (#7474) * Add experimental BSD job to CI * Remove container * cd into ` synergy/synergy/` * Change unix to bsd * Use only run param and not prepare * Install python3 on FreeBSD * Add missing command to prepare param * Add all the Unix-like BSD-derived * Use latest python3 for NetBSD and DragonFly BSD * Use env for cmd and correct prepare commands * Add deps config for unix-like * Install Python deps on Unix-like * Return matching entry in `get_unix_like_os` * Add cmake dep for cmakelang py module * Back out Unix-like support in `install_deps.py` (Python is tricky on BSD) * Back out BSD from config * Create install_deps.sh script for BSD-derived * Use .sh script instead of .py for BSD-derived * Add other case and fixed syntax * Use /usr/bin/env * Use more available sh * Restore debian command * Fixed syntax error * Remove prepare args * Remove space * Use which instead of command * Add libX11 dep * Add other BSD-derivatives * Set CMAKE_REQUIRED_INCLUDES * Fixed bad separator for CMAKE_REQUIRED_INCLUDES * Add debug lines * Set CMAKE_REQUIRED_LIBRARIES to lib names * use CMAKE_REQUIRED_QUIET * Set CMAKE_REQUIRED_FLAGS for BSD * Message for BSD packaging * Make PKG_CONFIG_FOUND optional * Move debug to all OS * Remove solaris for now, too many missing packages * Add missing override to XWindowsScreen.h * Add PC_GLIB_INCLUDE_DIRS * Fixed glib include * Make libnotify optional * Set CMAKE_LIBRARY_PATH * Only run tests if toml++ available * Also run integ tests * Remove DragonFly (C++ version too old) * Fixed NetBSD command * Aww sucks. Well, I tried. Patches welcome * Update ChangeLog * Fixed README for OpenBSD, NetBSD, DragonFly BSD, Solaris * Add missing case for SunOS * Drop redundant virtual specifiers * Print libs on FreeBSD * Restore link_directories * Beef up to ubuntu-24.04-16-core-x64, export QT_QPA_PLATFORM, improve comment * Remove debug line * Simplify debug text * Restore ubuntu-latest * Fixed really stupid typo * Beef up with ubuntu-22.04-16-core-x64 * Revert "Beef up with ubuntu-22.04-16-core-x64" This reverts commit 3de5773ef6c6eea99b93d3ee8448b0b95dc00dde. * Add missing name * Make .sh file primary deps file * Tweaked deps instruction label
2024-09-06 09:03:34 +00:00
void fakeInputBegin() override;
void fakeInputEnd() override;
2025-01-11 01:11:56 +00:00
int32_t getJumpZoneSize() const override;
2025-01-11 02:13:19 +00:00
bool isAnyMouseButtonDown(uint32_t &buttonID) const override;
2025-01-11 01:11:56 +00:00
void getCursorCenter(int32_t &x, int32_t &y) const override;
// ISecondaryScreen overrides
FreeBSD GitHub runner with `vmactions/freebsd-vm@v1` (#7474) * Add experimental BSD job to CI * Remove container * cd into ` synergy/synergy/` * Change unix to bsd * Use only run param and not prepare * Install python3 on FreeBSD * Add missing command to prepare param * Add all the Unix-like BSD-derived * Use latest python3 for NetBSD and DragonFly BSD * Use env for cmd and correct prepare commands * Add deps config for unix-like * Install Python deps on Unix-like * Return matching entry in `get_unix_like_os` * Add cmake dep for cmakelang py module * Back out Unix-like support in `install_deps.py` (Python is tricky on BSD) * Back out BSD from config * Create install_deps.sh script for BSD-derived * Use .sh script instead of .py for BSD-derived * Add other case and fixed syntax * Use /usr/bin/env * Use more available sh * Restore debian command * Fixed syntax error * Remove prepare args * Remove space * Use which instead of command * Add libX11 dep * Add other BSD-derivatives * Set CMAKE_REQUIRED_INCLUDES * Fixed bad separator for CMAKE_REQUIRED_INCLUDES * Add debug lines * Set CMAKE_REQUIRED_LIBRARIES to lib names * use CMAKE_REQUIRED_QUIET * Set CMAKE_REQUIRED_FLAGS for BSD * Message for BSD packaging * Make PKG_CONFIG_FOUND optional * Move debug to all OS * Remove solaris for now, too many missing packages * Add missing override to XWindowsScreen.h * Add PC_GLIB_INCLUDE_DIRS * Fixed glib include * Make libnotify optional * Set CMAKE_LIBRARY_PATH * Only run tests if toml++ available * Also run integ tests * Remove DragonFly (C++ version too old) * Fixed NetBSD command * Aww sucks. Well, I tried. Patches welcome * Update ChangeLog * Fixed README for OpenBSD, NetBSD, DragonFly BSD, Solaris * Add missing case for SunOS * Drop redundant virtual specifiers * Print libs on FreeBSD * Restore link_directories * Beef up to ubuntu-24.04-16-core-x64, export QT_QPA_PLATFORM, improve comment * Remove debug line * Simplify debug text * Restore ubuntu-latest * Fixed really stupid typo * Beef up with ubuntu-22.04-16-core-x64 * Revert "Beef up with ubuntu-22.04-16-core-x64" This reverts commit 3de5773ef6c6eea99b93d3ee8448b0b95dc00dde. * Add missing name * Make .sh file primary deps file * Tweaked deps instruction label
2024-09-06 09:03:34 +00:00
void fakeMouseButton(ButtonID id, bool press) override;
2025-01-11 01:11:56 +00:00
void fakeMouseMove(int32_t x, int32_t y) override;
void fakeMouseRelativeMove(int32_t dx, int32_t dy) const override;
void fakeMouseWheel(int32_t xDelta, int32_t yDelta) const override;
// IPlatformScreen overrides
FreeBSD GitHub runner with `vmactions/freebsd-vm@v1` (#7474) * Add experimental BSD job to CI * Remove container * cd into ` synergy/synergy/` * Change unix to bsd * Use only run param and not prepare * Install python3 on FreeBSD * Add missing command to prepare param * Add all the Unix-like BSD-derived * Use latest python3 for NetBSD and DragonFly BSD * Use env for cmd and correct prepare commands * Add deps config for unix-like * Install Python deps on Unix-like * Return matching entry in `get_unix_like_os` * Add cmake dep for cmakelang py module * Back out Unix-like support in `install_deps.py` (Python is tricky on BSD) * Back out BSD from config * Create install_deps.sh script for BSD-derived * Use .sh script instead of .py for BSD-derived * Add other case and fixed syntax * Use /usr/bin/env * Use more available sh * Restore debian command * Fixed syntax error * Remove prepare args * Remove space * Use which instead of command * Add libX11 dep * Add other BSD-derivatives * Set CMAKE_REQUIRED_INCLUDES * Fixed bad separator for CMAKE_REQUIRED_INCLUDES * Add debug lines * Set CMAKE_REQUIRED_LIBRARIES to lib names * use CMAKE_REQUIRED_QUIET * Set CMAKE_REQUIRED_FLAGS for BSD * Message for BSD packaging * Make PKG_CONFIG_FOUND optional * Move debug to all OS * Remove solaris for now, too many missing packages * Add missing override to XWindowsScreen.h * Add PC_GLIB_INCLUDE_DIRS * Fixed glib include * Make libnotify optional * Set CMAKE_LIBRARY_PATH * Only run tests if toml++ available * Also run integ tests * Remove DragonFly (C++ version too old) * Fixed NetBSD command * Aww sucks. Well, I tried. Patches welcome * Update ChangeLog * Fixed README for OpenBSD, NetBSD, DragonFly BSD, Solaris * Add missing case for SunOS * Drop redundant virtual specifiers * Print libs on FreeBSD * Restore link_directories * Beef up to ubuntu-24.04-16-core-x64, export QT_QPA_PLATFORM, improve comment * Remove debug line * Simplify debug text * Restore ubuntu-latest * Fixed really stupid typo * Beef up with ubuntu-22.04-16-core-x64 * Revert "Beef up with ubuntu-22.04-16-core-x64" This reverts commit 3de5773ef6c6eea99b93d3ee8448b0b95dc00dde. * Add missing name * Make .sh file primary deps file * Tweaked deps instruction label
2024-09-06 09:03:34 +00:00
void enable() override;
void disable() override;
void enter() override;
bool canLeave() override;
void leave() override;
FreeBSD GitHub runner with `vmactions/freebsd-vm@v1` (#7474) * Add experimental BSD job to CI * Remove container * cd into ` synergy/synergy/` * Change unix to bsd * Use only run param and not prepare * Install python3 on FreeBSD * Add missing command to prepare param * Add all the Unix-like BSD-derived * Use latest python3 for NetBSD and DragonFly BSD * Use env for cmd and correct prepare commands * Add deps config for unix-like * Install Python deps on Unix-like * Return matching entry in `get_unix_like_os` * Add cmake dep for cmakelang py module * Back out Unix-like support in `install_deps.py` (Python is tricky on BSD) * Back out BSD from config * Create install_deps.sh script for BSD-derived * Use .sh script instead of .py for BSD-derived * Add other case and fixed syntax * Use /usr/bin/env * Use more available sh * Restore debian command * Fixed syntax error * Remove prepare args * Remove space * Use which instead of command * Add libX11 dep * Add other BSD-derivatives * Set CMAKE_REQUIRED_INCLUDES * Fixed bad separator for CMAKE_REQUIRED_INCLUDES * Add debug lines * Set CMAKE_REQUIRED_LIBRARIES to lib names * use CMAKE_REQUIRED_QUIET * Set CMAKE_REQUIRED_FLAGS for BSD * Message for BSD packaging * Make PKG_CONFIG_FOUND optional * Move debug to all OS * Remove solaris for now, too many missing packages * Add missing override to XWindowsScreen.h * Add PC_GLIB_INCLUDE_DIRS * Fixed glib include * Make libnotify optional * Set CMAKE_LIBRARY_PATH * Only run tests if toml++ available * Also run integ tests * Remove DragonFly (C++ version too old) * Fixed NetBSD command * Aww sucks. Well, I tried. Patches welcome * Update ChangeLog * Fixed README for OpenBSD, NetBSD, DragonFly BSD, Solaris * Add missing case for SunOS * Drop redundant virtual specifiers * Print libs on FreeBSD * Restore link_directories * Beef up to ubuntu-24.04-16-core-x64, export QT_QPA_PLATFORM, improve comment * Remove debug line * Simplify debug text * Restore ubuntu-latest * Fixed really stupid typo * Beef up with ubuntu-22.04-16-core-x64 * Revert "Beef up with ubuntu-22.04-16-core-x64" This reverts commit 3de5773ef6c6eea99b93d3ee8448b0b95dc00dde. * Add missing name * Make .sh file primary deps file * Tweaked deps instruction label
2024-09-06 09:03:34 +00:00
bool setClipboard(ClipboardID, const IClipboard *) override;
void checkClipboards() override;
void openScreensaver(bool notify) override;
void closeScreensaver() override;
void screensaver(bool activate) override;
void resetOptions() override;
void setOptions(const OptionsList &options) override;
2025-01-11 02:13:19 +00:00
void setSequenceNumber(uint32_t) override;
FreeBSD GitHub runner with `vmactions/freebsd-vm@v1` (#7474) * Add experimental BSD job to CI * Remove container * cd into ` synergy/synergy/` * Change unix to bsd * Use only run param and not prepare * Install python3 on FreeBSD * Add missing command to prepare param * Add all the Unix-like BSD-derived * Use latest python3 for NetBSD and DragonFly BSD * Use env for cmd and correct prepare commands * Add deps config for unix-like * Install Python deps on Unix-like * Return matching entry in `get_unix_like_os` * Add cmake dep for cmakelang py module * Back out Unix-like support in `install_deps.py` (Python is tricky on BSD) * Back out BSD from config * Create install_deps.sh script for BSD-derived * Use .sh script instead of .py for BSD-derived * Add other case and fixed syntax * Use /usr/bin/env * Use more available sh * Restore debian command * Fixed syntax error * Remove prepare args * Remove space * Use which instead of command * Add libX11 dep * Add other BSD-derivatives * Set CMAKE_REQUIRED_INCLUDES * Fixed bad separator for CMAKE_REQUIRED_INCLUDES * Add debug lines * Set CMAKE_REQUIRED_LIBRARIES to lib names * use CMAKE_REQUIRED_QUIET * Set CMAKE_REQUIRED_FLAGS for BSD * Message for BSD packaging * Make PKG_CONFIG_FOUND optional * Move debug to all OS * Remove solaris for now, too many missing packages * Add missing override to XWindowsScreen.h * Add PC_GLIB_INCLUDE_DIRS * Fixed glib include * Make libnotify optional * Set CMAKE_LIBRARY_PATH * Only run tests if toml++ available * Also run integ tests * Remove DragonFly (C++ version too old) * Fixed NetBSD command * Aww sucks. Well, I tried. Patches welcome * Update ChangeLog * Fixed README for OpenBSD, NetBSD, DragonFly BSD, Solaris * Add missing case for SunOS * Drop redundant virtual specifiers * Print libs on FreeBSD * Restore link_directories * Beef up to ubuntu-24.04-16-core-x64, export QT_QPA_PLATFORM, improve comment * Remove debug line * Simplify debug text * Restore ubuntu-latest * Fixed really stupid typo * Beef up with ubuntu-22.04-16-core-x64 * Revert "Beef up with ubuntu-22.04-16-core-x64" This reverts commit 3de5773ef6c6eea99b93d3ee8448b0b95dc00dde. * Add missing name * Make .sh file primary deps file * Tweaked deps instruction label
2024-09-06 09:03:34 +00:00
bool isPrimary() const override;
std::string getSecureInputApp() const override;
2012-06-10 16:50:54 +00:00
protected:
// IPlatformScreen overrides
FreeBSD GitHub runner with `vmactions/freebsd-vm@v1` (#7474) * Add experimental BSD job to CI * Remove container * cd into ` synergy/synergy/` * Change unix to bsd * Use only run param and not prepare * Install python3 on FreeBSD * Add missing command to prepare param * Add all the Unix-like BSD-derived * Use latest python3 for NetBSD and DragonFly BSD * Use env for cmd and correct prepare commands * Add deps config for unix-like * Install Python deps on Unix-like * Return matching entry in `get_unix_like_os` * Add cmake dep for cmakelang py module * Back out Unix-like support in `install_deps.py` (Python is tricky on BSD) * Back out BSD from config * Create install_deps.sh script for BSD-derived * Use .sh script instead of .py for BSD-derived * Add other case and fixed syntax * Use /usr/bin/env * Use more available sh * Restore debian command * Fixed syntax error * Remove prepare args * Remove space * Use which instead of command * Add libX11 dep * Add other BSD-derivatives * Set CMAKE_REQUIRED_INCLUDES * Fixed bad separator for CMAKE_REQUIRED_INCLUDES * Add debug lines * Set CMAKE_REQUIRED_LIBRARIES to lib names * use CMAKE_REQUIRED_QUIET * Set CMAKE_REQUIRED_FLAGS for BSD * Message for BSD packaging * Make PKG_CONFIG_FOUND optional * Move debug to all OS * Remove solaris for now, too many missing packages * Add missing override to XWindowsScreen.h * Add PC_GLIB_INCLUDE_DIRS * Fixed glib include * Make libnotify optional * Set CMAKE_LIBRARY_PATH * Only run tests if toml++ available * Also run integ tests * Remove DragonFly (C++ version too old) * Fixed NetBSD command * Aww sucks. Well, I tried. Patches welcome * Update ChangeLog * Fixed README for OpenBSD, NetBSD, DragonFly BSD, Solaris * Add missing case for SunOS * Drop redundant virtual specifiers * Print libs on FreeBSD * Restore link_directories * Beef up to ubuntu-24.04-16-core-x64, export QT_QPA_PLATFORM, improve comment * Remove debug line * Simplify debug text * Restore ubuntu-latest * Fixed really stupid typo * Beef up with ubuntu-22.04-16-core-x64 * Revert "Beef up with ubuntu-22.04-16-core-x64" This reverts commit 3de5773ef6c6eea99b93d3ee8448b0b95dc00dde. * Add missing name * Make .sh file primary deps file * Tweaked deps instruction label
2024-09-06 09:03:34 +00:00
void handleSystemEvent(const Event &, void *) override;
void updateButtons() override;
IKeyState *getKeyState() const override;
2012-06-10 16:50:54 +00:00
private:
// event sending
void sendEvent(Event::Type, void * = NULL);
void sendClipboardEvent(Event::Type, ClipboardID);
2012-06-10 16:50:54 +00:00
// create the transparent cursor
Cursor createBlankCursor() const;
2012-06-10 16:50:54 +00:00
// determine the clipboard from the X selection. returns
// kClipboardEnd if no such clipboard.
ClipboardID getClipboardID(Atom selection) const;
2012-06-10 16:50:54 +00:00
// continue processing a selection request
void processClipboardRequest(Window window, Time time, Atom property);
2012-06-10 16:50:54 +00:00
// terminate a selection request
void destroyClipboardRequest(Window window);
2012-06-10 16:50:54 +00:00
// X I/O error handler
void onError();
static int ioErrorHandler(Display *);
2012-06-10 16:50:54 +00:00
private:
class KeyEventFilter
{
public:
int m_event;
Window m_window;
Time m_time;
KeyCode m_keycode;
};
Display *openDisplay(const char *displayName);
void saveShape();
2025-01-11 01:11:56 +00:00
void setShape(int32_t width, int32_t height);
Window openWindow() const;
void openIM();
bool grabMouseAndKeyboard();
void onKeyPress(XKeyEvent &);
void onKeyRelease(XKeyEvent &, bool isRepeat);
bool onHotKey(XKeyEvent &, bool isRepeat);
void onMousePress(const XButtonEvent &);
void onMouseRelease(const XButtonEvent &);
void onMouseMove(const XMotionEvent &);
bool detectXI2();
#ifdef HAVE_XI2
void selectXIRawMotion();
#endif
void selectEvents(Window) const;
void doSelectEvents(Window) const;
KeyID mapKeyFromX(XKeyEvent *) const;
ButtonID mapButtonFromX(const XButtonEvent *) const;
unsigned int mapButtonToX(ButtonID id) const;
2012-06-10 16:50:54 +00:00
2025-01-11 01:11:56 +00:00
void warpCursorNoFlush(int32_t x, int32_t y);
2012-06-10 16:50:54 +00:00
void refreshKeyboard(XEvent *);
2012-06-10 16:50:54 +00:00
static Bool findKeyEvent(Display *, XEvent *xevent, XPointer arg);
2012-06-10 16:50:54 +00:00
private:
struct HotKeyItem
{
public:
HotKeyItem(int, unsigned int);
bool operator<(const HotKeyItem &) const;
private:
int m_keycode;
unsigned int m_mask;
};
using FilteredKeycodes = std::set<bool>;
using HotKeyList = std::vector<std::pair<int, unsigned int>>;
2025-01-11 02:13:19 +00:00
using HotKeyMap = std::map<uint32_t, HotKeyList>;
using HotKeyIDList = std::vector<uint32_t>;
using HotKeyToIDMap = std::map<HotKeyItem, uint32_t>;
// true if screen is being used as a primary screen, false otherwise
bool m_isPrimary;
int m_mouseScrollDelta;
Display *m_display;
Window m_root;
Window m_window;
// true if mouse has entered the screen
bool m_isOnScreen;
// screen shape stuff
2025-01-11 01:11:56 +00:00
int32_t m_x, m_y;
int32_t m_w, m_h;
int32_t m_xCenter, m_yCenter;
// last mouse position
2025-01-11 01:11:56 +00:00
int32_t m_xCursor, m_yCursor;
// keyboard stuff
XWindowsKeyState *m_keyState;
// hot key stuff
HotKeyMap m_hotKeys;
HotKeyIDList m_oldHotKeyIDs;
HotKeyToIDMap m_hotKeyToIDMap;
// input focus stuff
Window m_lastFocus;
int m_lastFocusRevert;
// input method stuff
XIM m_im;
XIC m_ic;
KeyCode m_lastKeycode;
FilteredKeycodes m_filtered;
// clipboards
XWindowsClipboard *m_clipboard[kClipboardEnd];
2025-01-11 02:13:19 +00:00
uint32_t m_sequenceNumber;
// screen saver stuff
XWindowsScreenSaver *m_screensaver;
bool m_screensaverNotify;
// logical to physical button mapping. m_buttons[i] gives the
// physical button for logical button i+1.
std::vector<unsigned char> m_buttons;
// true if global auto-repeat was enabled before we turned it off
bool m_autoRepeat;
// stuff to workaround xtest being xinerama unaware. attempting
// to fake a mouse motion under xinerama may behave strangely,
// especially if screen 0 is not at 0,0 or if faking a motion on
// a screen other than screen 0.
bool m_xtestIsXineramaUnaware;
bool m_xinerama;
// stuff to work around lost focus issues on certain systems
// (ie: a MythTV front-end).
bool m_preserveFocus;
// XKB extension stuff
bool m_xkb;
int m_xkbEventBase;
bool m_xi2detected;
// XRandR extension stuff
bool m_xrandr;
int m_xrandrEventBase;
IEventQueue *m_events;
deskflow::KeyMap m_keyMap;
// pointer to (singleton) screen. this is only needed by
// ioErrorHandler().
static XWindowsScreen *s_screen;
XWindowsPowerManager m_powerManager;
2012-06-10 16:50:54 +00:00
};