]> git.tdb.fi Git - libs/gui.git/commitdiff
Fall back to Device::get_*_name if name can't be determined
authorMikko Rasa <tdb@tdb.fi>
Tue, 30 Aug 2011 18:26:39 +0000 (21:26 +0300)
committerMikko Rasa <tdb@tdb.fi>
Tue, 30 Aug 2011 18:26:39 +0000 (21:26 +0300)
source/input/keyboard.cpp
source/input/mouse.cpp

index 5b54ee4c0784f4210548b270e80e0942d0ad14d6..0f4d4ab848c772efb084f14cd18953c6cb412e26 100644 (file)
@@ -8,7 +8,6 @@
 #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"
 
@@ -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
 }
index cd89f94ad348a48efc7676fcfb52d9d4154a0b65..fce870f23aaf367b54155b55f5b9af82b0b51ac3 100644 (file)
@@ -3,7 +3,6 @@
 #endif
 #include <msp/graphics/window.h>
 #include <msp/graphics/window_priv.h>
-#include <msp/strings/format.h>
 #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);
        };
 }