3 #include <msp/graphics/window_private.h>
6 #include "keys_private.h"
11 std::string Keyboard::get_button_name(unsigned btn) const
16 const char *str = XKeysymToString(key_to_sys(btn));
18 return Device::get_button_name(btn);
22 void Keyboard::input_event(const Graphics::Window::Event &event)
24 switch(event.xevent.type)
29 KeySym keysym = XLookupKeysym(const_cast<XKeyEvent *>(&event.xevent.xkey), 0);
31 if(unsigned key = key_from_sys(keysym))
32 set_button_state(key, event.xevent.type==KeyPress, true);
33 if(event.xevent.type==KeyPress)
36 if(XLookupString(const_cast<XKeyEvent *>(&event.xevent.xkey), &ch, 1, 0, 0))
37 // XLookupString always returns Latin-1
38 signal_character.emit(static_cast<unsigned char>(ch));