X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Finput%2Fkeyboard.cpp;h=344048e802b43638df33ba97a4bd0f9059e7e869;hb=7d2b4349289578b8e7f322186a1f251684ddeb01;hp=4372be4f42bd5fbcfc707a842eae1494511c9665;hpb=7a4a508629d370c4a79791c7e62fd6f59e8564e9;p=libs%2Fgui.git diff --git a/source/input/keyboard.cpp b/source/input/keyboard.cpp index 4372be4..344048e 100644 --- a/source/input/keyboard.cpp +++ b/source/input/keyboard.cpp @@ -1,27 +1,27 @@ -/* $Id$ - -This file is part of libmspgbase -Copyright © 2007 Mikko Rasa, Mikkosoft Productions -Distributed under the LGPL -*/ - -#include -#include "../gbase/display.h" +#ifdef WIN32 +#include +#else +#include +#endif +#include +#include #include "keyboard.h" #include "keys.h" +#define MAPVK_VK_TO_VSC 0 + namespace Msp { namespace Input { -Keyboard::Keyboard(Graphics::Window &w): - window(w) +Keyboard::Keyboard(Graphics::EventSource &s): + source(s) { - name="Keyboard"; + name = "Keyboard"; buttons.resize(N_KEYS_, false); - window.signal_key_press.connect(sigc::mem_fun(this, &Keyboard::key_press)); - window.signal_key_release.connect(sigc::mem_fun(this, &Keyboard::key_release)); + source.signal_key_press.connect(sigc::mem_fun(this, &Keyboard::key_press)); + source.signal_key_release.connect(sigc::mem_fun(this, &Keyboard::key_release)); } std::string Keyboard::get_button_name(unsigned btn) const @@ -29,13 +29,13 @@ std::string Keyboard::get_button_name(unsigned btn) const if(btn==0) return "None"; #ifndef WIN32 - const char *str=XKeysymToString(key_to_sys(btn)); + 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_VCS); + 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;