3 #include <msp/graphics/window_private.h>
5 #include "keys_private.h"
10 std::string Keyboard::get_button_name(unsigned btn) const
15 const char *str = XKeysymToString(key_to_sys(btn));
17 return Device::get_button_name(btn);
21 void Keyboard::input_event(const Graphics::Window::Event &event)
23 switch(event.xevent.type)
28 KeySym keysym = XLookupKeysym(const_cast<XKeyEvent *>(&event.xevent.xkey), 0);
30 if(unsigned key = key_from_sys(keysym))
31 set_button_state(key, event.xevent.type==KeyPress, true);
32 if(event.xevent.type==KeyPress)
35 if(XLookupString(const_cast<XKeyEvent *>(&event.xevent.xkey), &ch, 1, 0, 0))
36 // XLookupString always returns Latin-1
37 signal_character.emit(static_cast<unsigned char>(ch));