Files
deskflow/src/lib/platform/XDGKeyUtil.h
James Le Cuirot 93beb491db fix: Split XKB code out of XWindowsUtil to allow building without X11
the xprotoheaders are still required for EI, but nothing more.
2025-11-14 13:28:41 +00:00

44 lines
1.0 KiB
C++

/*
* 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
#include <X11/X.h>
#include <cstdint>
#include <map>
#include <vector>
//! XKB utility functions
class XDGKeyUtil
{
public:
typedef std::vector<KeySym> KeySyms;
//! 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:
static void initKeyMaps();
typedef std::map<KeySym, std::uint32_t> KeySymMap;
static KeySymMap s_keySymToUCS4;
};