2025-11-13 16:05:52 +00:00
|
|
|
/*
|
|
|
|
|
* Deskflow -- mouse and keyboard sharing utility
|
|
|
|
|
* SPDX-FileCopyrightText: (C) 2025 Deskflow Developers
|
|
|
|
|
* SPDX-FileCopyrightText: (C) 2012 - 2016 Symless Ltd.
|
|
|
|
|
* SPDX-FileCopyrightText: (C) 2002 Chris Schoeneman
|
|
|
|
|
* SPDX-License-Identifier: GPL-2.0-only WITH LicenseRef-OpenSSL-Exception
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
2025-11-13 16:31:25 +00:00
|
|
|
#include <array>
|
2025-11-13 16:05:52 +00:00
|
|
|
#include <cstdint>
|
|
|
|
|
#include <map>
|
|
|
|
|
|
2025-11-13 16:42:30 +00:00
|
|
|
using KeySym = unsigned long;
|
2025-11-13 16:47:11 +00:00
|
|
|
using KeySymMap = std::map<KeySym, uint32_t>;
|
2025-11-13 16:42:30 +00:00
|
|
|
|
2025-11-13 16:05:52 +00:00
|
|
|
//! XKB utility functions
|
|
|
|
|
class XDGKeyUtil
|
|
|
|
|
{
|
2025-11-13 16:42:30 +00:00
|
|
|
|
2025-11-13 16:05:52 +00:00
|
|
|
public:
|
|
|
|
|
//! Convert KeySym to KeyID
|
|
|
|
|
/*!
|
|
|
|
|
Converts a KeySym to the equivalent KeyID. Returns kKeyNone if the
|
|
|
|
|
KeySym cannot be mapped.
|
|
|
|
|
*/
|
|
|
|
|
static std::uint32_t mapKeySymToKeyID(KeySym);
|
|
|
|
|
|
|
|
|
|
//! Convert KeySym to corresponding KeyModifierMask
|
|
|
|
|
/*!
|
|
|
|
|
Converts a KeySym to the corresponding KeyModifierMask, or 0 if the
|
|
|
|
|
KeySym is not a modifier.
|
|
|
|
|
*/
|
|
|
|
|
static std::uint32_t getModifierBitForKeySym(KeySym keysym);
|
|
|
|
|
|
|
|
|
|
private:
|
2025-11-13 16:47:11 +00:00
|
|
|
static const KeySymMap s_keySymToUCS4;
|
2025-11-13 16:31:25 +00:00
|
|
|
// map "Internet" keys to KeyIDs
|
2025-11-13 16:47:11 +00:00
|
|
|
static const std::array<KeySym, 256> s_map1008FF;
|
2025-11-13 16:05:52 +00:00
|
|
|
};
|