* SYNERGY-907 Client tray language switcher reverts to EN *Fix checkbox spelling * SYNERGY-907 Client tray language switcher reverts to EN *Update changelog * SYNERGY-907 Client tray language switcher reverts to EN *Temporary disable language sync logic * SYNERGY-907 client tray language switcher reverts to en *Update changelog * Synergy 907 client tray language switcher reverts to en *Fix sonar * Synergy 907 client tray language switcher reverts to en *Fix sonar * Synergy 907 client tray language switcher reverts to en *Fix chnagelog * SYNERGY-907 Client tray language switcher reverts to EN *Add prototype of keyboard layout names transfer(Windows part) * SYNERGY-907 Client tray language switcher reverts to EN *Add keyboard layout determination(Mac part) * SYNERGY-907 Client tray language switcher reverts to EN *Add language check on client side * SYNERGY-907 Client tray language switcher reverts to EN *Fix Windows build * SYNERGY-907-Client-tray-language-switcher-reverts-to-EN *Add logs * SYNERGY-907-Client-tray-language-switcher-reverts-to-EN *Add protocol update * SYNERGY-907-Client-tray-language-switcher-reverts-to-EN *Add server side of language sync * SYNERGY-907-Client-tray-language-switcher-reverts-to-EN *Remove unused variables * SYNERGY-907-Client-tray-language-switcher-reverts-to-EN *AFix mac language determination * SYNERGY-907-Client-tray-language-switcher-reverts-to-EN *Clean up logs * SYNERGY-907 Client tray language switcher reverts to EN *Replace logs with messagebox on Windows * SYNERGY-907-Client-tray-language-switcher-reverts-to-EN *Add mac messagebox, revert protocol changes * SYNERGY-907-Client-tray-language-switcher-reverts-to-EN *Fix minor language bugs * SYNERGY-907-Client-tray-language-switcher-reverts-to-EN *Update chagelog * SYNERGY-907-Client-tray-language-switcher-reverts-to-EN *Minor fixes * SYNERGY-907-Client-tray-language-switcher-reverts-to-EN *Fix Linux build * SYNERGY-907-Client-tray-language-switcher-reverts-to-EN *Fix sonar code smells * SYNERGY-907-Client-tray-language-switcher-reverts-to-EN *Fix Linux build * SYNERGY-907-Client-tray-language-switcher-reverts-to-EN *Add Linux language determination * SYNERGY-907-Client-tray-language-switcher-reverts-to-EN *Fix sonar codesmells * SYNERGY-907-Client-tray-language-switcher-reverts-to-EN *Fix sonar codesmells * SYNERGY-907-Client-tray-language-switcher-reverts-to-EN *Replace custom xml parser with tinyxml2 * SYNERGY-907 Client tray language switcher reverts to EN *Fix PR comments * SYNERGY-907 Client tray language switcher reverts to EN *Update changelog * SYNERGY-907 Client tray language switcher reverts to EN *Fix unix build * SYNERGY-907 Client tray language switcher reverts to EN *Fix unix build * SYNERGY-907 Client tray language switcher reverts to EN *Fix sonar code smells * SYNERGY-907 Client tray language switcher reverts to EN *Update changelog * SYNERGY-907 Client tray language switcher reverts to EN *Replace tinuxml with pugixml * SYNERGY-907 Client tray language switcher reverts to EN *Add pugixml as a git submodule * SYNERGY-907 Client tray language switcher reverts to EN *Add missed files * SYNERGY-907 Client tray language switcher reverts to EN *Fix sonar code smells * SYNERGY-907 Client tray language switcher reverts to EN *Fix comments from PR * SYNERGY-907 Client tray language switcher reverts to EN *Fix sonar code smell * SYNERGY-907 Client tray language switcher reverts to EN *add tests for x11 files parser * SYNERGY-907 Client tray language switcher reverts to EN *Fix include for unix build * SYNERGY-907 Client tray language switcher reverts to EN *Add test coverage for new logic * SYNERGY-907 Client tray language switcher reverts to EN *Add test coverage for new logic * SYNERGY-907 Client tray language switcher reverts to EN *Add code coverage *Fix code smells * SYNERGY-907 Client tray language switcher reverts to EN *Return missed file * SYNERGY-907 Client tray language switcher reverts to EN *Improve code coverage of x11Layouts parser * SYNERGY-907 Client tray language switcher reverts to EN *Add client args code coverage * SYNERGY-907 Client tray language switcher reverts to EN *Return runtime language sync * SYNERGY-907 Client tray language switcher reverts to EN *Return windows current keyboard layout determination * SYNERGY-907 Client tray language switcher reverts to EN *Return Linux language determination * SYNERGY-907 Client tray language switcher reverts to EN *Remove debug code * SYNERGY-907 Client tray language switcher reverts to EN *Move back Carbon current language determination * SYNERGY-907 Client tray language switcher reverts to EN *Fix language change for existed languages on iOS and Linux * SYNERGY-907 Client tray language switcher reverts to EN *Return protocol missed parameter * SYNERGY-907 Client tray language switcher reverts to EN *Fix macOS language change * SYNERGY-907 Client tray language switcher reverts to EN *Fix language sync (when it is disabled) * SYNERGY-907 Client tray language switcher reverts to EN *Add correct language choosing *Fix code coverage tests * SYNERGY-907 Client tray language switcher reverts to EN *Fix windows build and tests * SYNERGY-907 Client tray language switcher reverts to EN *Fix macOS build and tests * SYNERGY-907 Client tray language switcher reverts to EN *Fix language change for first letter in keystroke * SYNERGY-907 Client tray language switcher reverts to EN *Fix macOS build * SYNERGY-907 Client tray language switcher reverts to EN *Partially fix Sonar codesmells * SYNERGY-907 Client tray language switcher reverts to EN *Partially fix Sonar codesmells * SYNERGY-907 Client tray language switcher reverts to EN *Fix build * SYNERGY-907 Client tray language switcher reverts to EN *Added logging for language change process *Fixed language change process for Windows * SYNERGY-907 Client tray language switcher reverts to EN *Fix double layout change in key repeat event * SYNERGY-907 Client tray language switcher reverts to EN *Fix determination of current language on windows *Removed legacy code of restoring language when leaving screen *Fix double group change on Linux * SYNERGY-907 Client tray language switcher reverts to EN *Temp fix for language change on Linux * SYNERGY-907 Client tray language switcher reverts to EN *Add XSync to normalize Linux language polling and setting *Remove setxkbmap using * SYNERGY-907 Client tray language switcher reverts to EN *Add keyboard layout changing on Linux with DBus * SYNERGY-907 Client tray language switcher reverts to EN *Add comments to new language change function *Logical fix * SYNERGY-907 Client tray language switcher reverts to EN *Remove input attaching * SYNERGY-907 Client tray language switcher reverts to EN *Fix language change on macOS * SYNERGY-907 Fix review issues * SYNERGY-907 Fix review comment for Windows * SYNERGY-907 Removed debug trace Co-authored-by: Andrii Batyiev <andrii-external@symless.com> Co-authored-by: user <user@users-Mac-mini.local> Co-authored-by: Serhii Hadzhilov <serhii-external@symless.com>
180 lines
5.5 KiB
C++
180 lines
5.5 KiB
C++
/*
|
|
* synergy -- mouse and keyboard sharing utility
|
|
* Copyright (C) 2012-2016 Symless Ltd.
|
|
* Copyright (C) 2003 Chris Schoeneman
|
|
*
|
|
* This package is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU General Public License
|
|
* found in the file LICENSE that should have accompanied this file.
|
|
*
|
|
* This package 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 program. If not, see <http://www.gnu.org/licenses/>.
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "synergy/KeyState.h"
|
|
#include "common/stdmap.h"
|
|
#include "common/stdvector.h"
|
|
|
|
#if X_DISPLAY_MISSING
|
|
# error X11 is required to build synergy
|
|
#else
|
|
# include <X11/Xlib.h>
|
|
# if HAVE_X11_EXTENSIONS_XTEST_H
|
|
# include <X11/extensions/XTest.h>
|
|
# else
|
|
# error The XTest extension is required to build synergy
|
|
# endif
|
|
# if HAVE_XKB_EXTENSION
|
|
# include <X11/extensions/XKBstr.h>
|
|
# endif
|
|
#endif
|
|
|
|
class IEventQueue;
|
|
|
|
//! X Windows key state
|
|
/*!
|
|
A key state for X Windows.
|
|
*/
|
|
class XWindowsKeyState : public KeyState {
|
|
public:
|
|
typedef std::vector<int> KeycodeList;
|
|
enum {
|
|
kGroupPoll = -1,
|
|
kGroupPollAndSet = -2
|
|
};
|
|
|
|
XWindowsKeyState(Display*, bool useXKB, IEventQueue* events);
|
|
XWindowsKeyState(Display*, bool useXKB,
|
|
IEventQueue* events, synergy::KeyMap& keyMap);
|
|
~XWindowsKeyState();
|
|
|
|
//! @name modifiers
|
|
//@{
|
|
|
|
//! Set active group
|
|
/*!
|
|
Sets the active group to \p group. This is the group returned by
|
|
\c pollActiveGroup(). If \p group is \c kGroupPoll then
|
|
\c pollActiveGroup() will really poll, but that's a slow operation
|
|
on X11. If \p group is \c kGroupPollAndSet then this will poll the
|
|
active group now and use it for future calls to \c pollActiveGroup().
|
|
*/
|
|
void setActiveGroup(SInt32 group);
|
|
|
|
//! Set the auto-repeat state
|
|
/*!
|
|
Sets the auto-repeat state.
|
|
*/
|
|
void setAutoRepeat(const XKeyboardState&);
|
|
|
|
//@}
|
|
//! @name accessors
|
|
//@{
|
|
|
|
//! Convert X modifier mask to synergy mask
|
|
/*!
|
|
Returns the synergy modifier mask corresponding to the X modifier
|
|
mask in \p state.
|
|
*/
|
|
KeyModifierMask mapModifiersFromX(unsigned int state) const;
|
|
|
|
//! Convert synergy modifier mask to X mask
|
|
/*!
|
|
Converts the synergy modifier mask to the corresponding X modifier
|
|
mask. Returns \c true if successful and \c false if any modifier
|
|
could not be converted.
|
|
*/
|
|
bool mapModifiersToX(KeyModifierMask, unsigned int&) const;
|
|
|
|
//! Convert synergy key to all corresponding X keycodes
|
|
/*!
|
|
Converts the synergy key \p key to all of the keycodes that map to
|
|
that key.
|
|
*/
|
|
void mapKeyToKeycodes(KeyID key,
|
|
KeycodeList& keycodes) const;
|
|
|
|
//@}
|
|
|
|
// IKeyState overrides
|
|
virtual bool fakeCtrlAltDel();
|
|
virtual KeyModifierMask
|
|
pollActiveModifiers() const;
|
|
virtual SInt32 pollActiveGroup() const;
|
|
virtual void pollPressedKeys(KeyButtonSet& pressedKeys) const;
|
|
|
|
protected:
|
|
// KeyState overrides
|
|
virtual void getKeyMap(synergy::KeyMap& keyMap);
|
|
virtual void fakeKey(const Keystroke& keystroke);
|
|
|
|
private:
|
|
void init(Display* display, bool useXKB);
|
|
void updateKeysymMap(synergy::KeyMap&);
|
|
void updateKeysymMapXKB(synergy::KeyMap&);
|
|
bool hasModifiersXKB() const;
|
|
int getEffectiveGroup(KeyCode, int group) const;
|
|
UInt32 getGroupFromState(unsigned int state) const;
|
|
|
|
//! Create and send language change request to \p group by DBus interface
|
|
/*!
|
|
Returns the existance of nedeed DBus interface.
|
|
*/
|
|
bool setCurrentLanguageWithDBus(SInt32 group) const;
|
|
|
|
static void remapKeyModifiers(KeyID, SInt32,
|
|
synergy::KeyMap::KeyItem&, void*);
|
|
|
|
private:
|
|
struct XKBModifierInfo {
|
|
public:
|
|
unsigned char m_level;
|
|
UInt32 m_mask;
|
|
bool m_lock;
|
|
};
|
|
|
|
#ifdef TEST_ENV
|
|
public: // yuck
|
|
#endif
|
|
typedef std::vector<KeyModifierMask> KeyModifierMaskList;
|
|
|
|
private:
|
|
typedef std::map<KeyModifierMask, unsigned int> KeyModifierToXMask;
|
|
typedef std::multimap<KeyID, KeyCode> KeyToKeyCodeMap;
|
|
typedef std::map<KeyCode, unsigned int> NonXKBModifierMap;
|
|
typedef std::map<UInt32, XKBModifierInfo> XKBModifierMap;
|
|
|
|
Display* m_display;
|
|
#if HAVE_XKB_EXTENSION
|
|
XkbDescPtr m_xkb;
|
|
#endif
|
|
SInt32 m_group;
|
|
XKBModifierMap m_lastGoodXKBModifiers;
|
|
NonXKBModifierMap m_lastGoodNonXKBModifiers;
|
|
|
|
// X modifier (bit number) to synergy modifier (mask) mapping
|
|
KeyModifierMaskList m_modifierFromX;
|
|
|
|
// synergy modifier (mask) to X modifier (mask)
|
|
KeyModifierToXMask m_modifierToX;
|
|
|
|
// map KeyID to all keycodes that can synthesize that KeyID
|
|
KeyToKeyCodeMap m_keyCodeFromKey;
|
|
|
|
// autorepeat state
|
|
XKeyboardState m_keyboardState;
|
|
|
|
#ifdef TEST_ENV
|
|
public:
|
|
SInt32 group() const { return m_group; }
|
|
void group(const SInt32& group) { m_group = group; }
|
|
KeyModifierMaskList modifierFromX() const { return m_modifierFromX; }
|
|
#endif
|
|
};
|