xbmc
LibInputKeyboard.h
1 /*
2  * Copyright (C) 2005-2018 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 #include "threads/Timer.h"
12 #include "windowing/XBMC_events.h"
13 
14 #include <map>
15 #include <vector>
16 
17 #include <libinput.h>
18 #include <xkbcommon/xkbcommon.h>
19 
21 {
22 public:
25 
26  void ProcessKey(libinput_event_keyboard *e);
27  void UpdateLeds(libinput_device *dev);
28  void GetRepeat(libinput_device *dev);
29 
30  bool SetKeymap(const std::string& layout);
31 
32 private:
33  XBMCKey XBMCKeyForKeysym(xkb_keysym_t sym, uint32_t scancode);
34  void KeyRepeatTimeout();
35 
36  xkb_context *m_ctx = nullptr;
37  xkb_keymap *m_keymap = nullptr;
38  xkb_state *m_state = nullptr;
39  xkb_mod_index_t m_modindex[4];
40  xkb_led_index_t m_ledindex[3];
41 
42  int m_leds;
43 
44  XBMC_Event m_repeatEvent;
45  std::map<libinput_device*, std::vector<int>> m_repeatData;
46  CTimer m_repeatTimer;
47  int m_repeatRate;
48 };
Definition: LibInputKeyboard.h:20
Definition: Timer.h:25
Definition: XBMC_events.h:109