| 1 |
/* |
| 2 |
* Copyright (C) 2007-2024 Team Kodi |
| 3 |
* This file is part of Kodi - https://kodi.tv |
| 4 |
* |
| 5 |
* SPDX-License-Identifier: GPL-2.0-or-later |
| 6 |
* See LICENSES/README.md for more information. |
| 7 |
*/ |
| 8 |
|
| 9 |
#pragma once |
| 10 |
|
| 11 |
// |
| 12 |
// C++ Interface: CKeyboard |
| 13 |
// |
| 14 |
// Description: Adds features like international keyboard layout mapping on top of the |
| 15 |
// platform specific low level keyboard classes. |
| 16 |
// Here it must be done only once. Within the other mentioned classes it would have to be done |
| 17 |
// several times. |
| 18 |
// |
| 19 |
// Keyboards always deliver printable characters, logical keys for functional behaviour, modifiers |
| 20 |
// ... alongside Based on the same hardware with the same scancodes (also alongside) but delivered |
| 21 |
// with different labels to customers the software must solve the mapping to the real labels. This |
| 22 |
// is done here. The mapping must be specified by an xml configuration that should be able to access |
| 23 |
// everything available, but this allows for double/redundant or ambiguous mapping definition, e.g. |
| 24 |
// ASCII/unicode could be derived from scancodes, virtual keys, modifiers and/or other |
| 25 |
// ASCII/unicode. |
| 26 |
|
| 27 |
#include "input/keyboard/Key.h" |
| 28 |
#include "input/keyboard/XBMC_keyboard.h" |
| 29 |
|
| 30 |
#include <chrono> |
| 31 |
#include <string> |
| 32 |
|
| 33 |
namespace KODI |
| 34 |
{ |
| 35 |
namespace KEYBOARD |
| 36 |
{ |
| 37 |
/*! |
| 38 |
* \ingroup keyboard |
| 39 |
*/ |
| 40 |
class CKeyboardStat |
| 41 |
{ |
| 42 |
public: |
| 43 |
CKeyboardStat(); |
| 44 |
~CKeyboardStat() = default; |
| 45 |
|
| 46 |
void Initialize(); |
| 47 |
|
| 48 |
CKey TranslateKey(XBMC_keysym& keysym) const; |
| 49 |
|
| 50 |
void ProcessKeyDown(XBMC_keysym& keysym); |
| 51 |
void ProcessKeyUp(void); |
| 52 |
|
| 53 |
std::string GetKeyName(int KeyID); |
| 54 |
|
| 55 |
private: |
| 56 |
static bool LookupSymAndUnicodePeripherals(XBMC_keysym& keysym, uint8_t* key, char* unicode); |
| 57 |
|
| 58 |
XBMC_keysym m_lastKeysym; |
| 59 |
std::chrono::time_point<std::chrono::steady_clock> m_lastKeyTime; |
| 60 |
}; |
| 61 |
} // namespace KEYBOARD |
| 62 |
} // namespace KODI |