From 5ccbbe9ba2daa4d5f0c047be022f6cfeec946598 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Tue, 30 Aug 2011 21:26:39 +0300 Subject: [PATCH] Fall back to Device::get_*_name if name can't be determined --- source/input/keyboard.cpp | 5 ++--- source/input/mouse.cpp | 5 ++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/source/input/keyboard.cpp b/source/input/keyboard.cpp index 5b54ee4..0f4d4ab 100644 --- a/source/input/keyboard.cpp +++ b/source/input/keyboard.cpp @@ -8,7 +8,6 @@ #include #include #include -#include #include "keyboard.h" #include "keys.h" @@ -34,13 +33,13 @@ std::string Keyboard::get_button_name(unsigned btn) const #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 } diff --git a/source/input/mouse.cpp b/source/input/mouse.cpp index cd89f94..fce870f 100644 --- a/source/input/mouse.cpp +++ b/source/input/mouse.cpp @@ -3,7 +3,6 @@ #endif #include #include -#include #include "mouse.h" namespace Msp { @@ -35,7 +34,7 @@ std::string Mouse::get_button_name(unsigned btn) const case 5: return "Wheel Down"; default: - return format("Button %d", btn); + return Device::get_button_name(btn); } } @@ -48,7 +47,7 @@ std::string Mouse::get_axis_name(unsigned axis) const case 1: return "Y axis"; default: - return format("Axis %d", axis); + return Device::get_axis_name(axis); }; } -- 2.43.0