From 7312ff82ead10ae39f922f49b920d12dba28c9e8 Mon Sep 17 00:00:00 2001 From: Mikko Rasa Date: Wed, 5 Jun 2013 09:59:22 +0300 Subject: [PATCH] Add KEY_NONE constant --- source/input/keys.h | 2 ++ source/input/windows/keyboard.cpp | 3 ++- source/input/x11/keyboard.cpp | 3 ++- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/source/input/keys.h b/source/input/keys.h index c5822f8..7d4822c 100644 --- a/source/input/keys.h +++ b/source/input/keys.h @@ -6,6 +6,8 @@ namespace Input { enum { + KEY_NONE = 0x00, + // Codes 0x01-0x7E reserved for ASCII KEY_BACKSPACE = 0x08, KEY_TAB = 0x09, diff --git a/source/input/windows/keyboard.cpp b/source/input/windows/keyboard.cpp index 24b019e..cbba914 100644 --- a/source/input/windows/keyboard.cpp +++ b/source/input/windows/keyboard.cpp @@ -1,6 +1,7 @@ #include #include #include "keyboard.h" +#include "keys.h" #include "keys_private.h" #define MAPVK_VK_TO_VSC 0 @@ -10,7 +11,7 @@ namespace Input { std::string Keyboard::get_button_name(unsigned btn) const { - if(btn==0) + if(btn==KEY_NONE) return "None"; char buf[128]; diff --git a/source/input/x11/keyboard.cpp b/source/input/x11/keyboard.cpp index 50142c9..68247e4 100644 --- a/source/input/x11/keyboard.cpp +++ b/source/input/x11/keyboard.cpp @@ -2,6 +2,7 @@ #include #include #include "keyboard.h" +#include "keys.h" #include "keys_private.h" namespace Msp { @@ -9,7 +10,7 @@ namespace Input { std::string Keyboard::get_button_name(unsigned btn) const { - if(btn==0) + if(btn==KEY_NONE) return "None"; const char *str = XKeysymToString(key_to_sys(btn)); -- 2.45.2