-std::string Keyboard::get_button_name(unsigned btn) const
-{
- if(btn==0)
- return "None";
-#ifndef WIN32
- const char *str = XKeysymToString(key_to_sys(btn));
- if(!str)
- return format("Key %d", btn);
- return str;
-#else
- char buf[128];
- unsigned scan = MapVirtualKey(key_to_sys(btn), MAPVK_VK_TO_VSC);
- if(!GetKeyNameText(scan<<16, buf, sizeof(buf)))
- return format("Key %d", btn);
- return buf;
-#endif
-}
-
-void Keyboard::key_press(unsigned key, unsigned, unsigned)
-{
- set_button_state(key_from_sys(key), true, true);
-}
-
-void Keyboard::key_release(unsigned key, unsigned)
-{
- set_button_state(key_from_sys(key), false, true);
-}