deskflow/src/lib/synergy/IKeyState.h
Andrey Batyiev e9e21aad8f
Synergy 907 client tray language switcher reverts to en (#7038)
* 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>
2021-10-04 18:51:12 +03:00

174 lines
5.1 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/key_types.h"
#include "base/Event.h"
#include "base/String.h"
#include "base/IEventQueue.h"
#include "base/EventTypes.h"
#include "common/stdset.h"
#include "common/IInterface.h"
//! Key state interface
/*!
This interface provides access to set and query the keyboard state and
to synthesize key events.
*/
class IKeyState : public IInterface {
public:
IKeyState(IEventQueue* events);
enum {
kNumButtons = 0x200
};
//! Key event data
class KeyInfo {
public:
static KeyInfo* alloc(KeyID, KeyModifierMask, KeyButton, SInt32 count);
static KeyInfo* alloc(KeyID, KeyModifierMask, KeyButton, SInt32 count,
const std::set<String>& destinations);
static KeyInfo* alloc(const KeyInfo&);
static bool isDefault(const char* screens);
static bool contains(const char* screens, const String& name);
static bool equal(const KeyInfo*, const KeyInfo*);
static String join(const std::set<String>& destinations);
static void split(const char* screens, std::set<String>&);
public:
KeyID m_key;
KeyModifierMask m_mask;
KeyButton m_button;
SInt32 m_count;
char* m_screens;
char m_screensBuffer[1];
};
typedef std::set<KeyButton> KeyButtonSet;
//! @name manipulators
//@{
//! Update the keyboard map
/*!
Causes the key state to get updated to reflect the current keyboard
mapping.
*/
virtual void updateKeyMap() = 0;
//! Update the key state
/*!
Causes the key state to get updated to reflect the physical keyboard
state.
*/
virtual void updateKeyState() = 0;
//! Set half-duplex mask
/*!
Sets which modifier toggle keys are half-duplex. A half-duplex
toggle key doesn't report a key release when toggled on and
doesn't report a key press when toggled off.
*/
virtual void setHalfDuplexMask(KeyModifierMask) = 0;
//! Fake a key press
/*!
Synthesizes a key press event and updates the key state.
*/
virtual void fakeKeyDown(KeyID id, KeyModifierMask mask,
KeyButton button, const String& lang) = 0;
//! Fake a key repeat
/*!
Synthesizes a key repeat event and updates the key state.
*/
virtual bool fakeKeyRepeat(KeyID id, KeyModifierMask mask,
SInt32 count, KeyButton button, const String& lang) = 0;
//! Fake a key release
/*!
Synthesizes a key release event and updates the key state.
*/
virtual bool fakeKeyUp(KeyButton button) = 0;
//! Fake key releases for all fake pressed keys
/*!
Synthesizes a key release event for every key that is synthetically
pressed and updates the key state.
*/
virtual void fakeAllKeysUp() = 0;
//! Fake ctrl+alt+del
/*!
Synthesize a press of ctrl+alt+del. Return true if processing is
complete and false if normal key processing should continue.
*/
virtual bool fakeCtrlAltDel() = 0;
//! Fake a media key
/*!
Synthesizes a media key down and up. Only Mac would implement this by
use cocoa appkit framework.
*/
virtual bool fakeMediaKey(KeyID id) = 0;
//@}
//! @name accessors
//@{
//! Test if key is pressed
/*!
Returns true iff the given key is down. Half-duplex toggles
always return false.
*/
virtual bool isKeyDown(KeyButton) const = 0;
//! Get the active modifiers
/*!
Returns the modifiers that are currently active according to our
shadowed state.
*/
virtual KeyModifierMask
getActiveModifiers() const = 0;
//! Get the active modifiers from OS
/*!
Returns the modifiers that are currently active according to the
operating system.
*/
virtual KeyModifierMask
pollActiveModifiers() const = 0;
//! Get the active keyboard layout from OS
/*!
Returns the active keyboard layout according to the operating system.
*/
virtual SInt32 pollActiveGroup() const = 0;
//! Get the keys currently pressed from OS
/*!
Adds any keys that are currently pressed according to the operating
system to \p pressedKeys.
*/
virtual void pollPressedKeys(KeyButtonSet& pressedKeys) const = 0;
//@}
};