#include <msp/graphics/window.h>
#include <msp/graphics/display_priv.h>
#include <msp/graphics/window_priv.h>
-#include <msp/strings/format.h>
#include "keyboard.h"
#include "keys.h"
#ifndef WIN32
const char *str = XKeysymToString(key_to_sys(btn));
if(!str)
- return format("Key %d", btn);
+ return Device::get_button_name(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 Device::get_button_name(btn);
return buf;
#endif
}
{
KeySym keysym = XKeycodeToKeysym(window.get_display().get_private().display, event.xevent.xkey.keycode, 0);
if(keysym!=NoSymbol)
- set_button_state(key_from_sys(keysym), event.xevent.type==KeyPress, true);
+ if(unsigned key = key_from_sys(keysym))
+ set_button_state(key, event.xevent.type==KeyPress, true);
if(event.xevent.type==KeyPress)
{
char ch;