4 * Copyright (C) 2005-2013 Team XBMC
7 * This Program is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2, or (at your option)
12 * This Program is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with XBMC; see the file COPYING. If not, see
19 * <http://www.gnu.org/licenses/>.
22 #include <boost/scoped_ptr.hpp>
24 #include "input/linux/Keymap.h"
26 #include "TimeoutManager.h"
33 enum wl_keyboard_key_state;
39 /* KeyboardProcessor implements IKeyboardReceiver and transforms
40 * keyboard events into XBMC events for further processing.
42 * It needs to know whether or not a surface is in focus, so as soon
43 * as a surface is available, SetXBMCSurface should be called.
45 * KeyboardProcessor also performs key-repeat and registers a callback
46 * function to repeat the currently depressed key if it has not been
47 * released within a certain period. As such it depends on
49 class KeyboardProcessor :
50 public wayland::IKeyboardReceiver
54 KeyboardProcessor(IEventListener &listener,
55 ITimeoutManager &timeouts);
58 void SetXBMCSurface(struct wl_surface *xbmcWindow);
62 void UpdateKeymap(ILinuxKeymap *);
63 void Enter(uint32_t serial,
64 struct wl_surface *surface,
65 struct wl_array *keys);
66 void Leave(uint32_t serial,
67 struct wl_surface *surface);
68 void Key(uint32_t serial,
71 enum wl_keyboard_key_state state);
72 void Modifier(uint32_t serial,
78 void SendKeyToXBMC(uint32_t key,
81 void RepeatCallback(uint32_t key,
84 IEventListener &m_listener;
85 ITimeoutManager &m_timeouts;
86 struct wl_surface *m_xbmcWindow;
88 ITimeoutManager::CallbackPtr m_repeatCallback;
91 struct xkb_context *m_context;
93 /* KeyboardProcessor has an observing reference to the keymap and
94 * does parts of its processing by delegating to the keymap the job
95 * of looking up generic keysyms for keycodes */
96 ILinuxKeymap *m_keymap;