X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;ds=sidebyside;f=source%2Finput%2Fkeyboard.cpp;h=344048e802b43638df33ba97a4bd0f9059e7e869;hb=dce7552c5e2f64fcf5f58b0c934bb4a01f6cbcf7;hp=1d7bb659e4973944ff2cc7b6665ed089c1c7ddf8;hpb=9164e74de9dc17c74ee9f3cea21c4d247a3835d9;p=libs%2Fgui.git diff --git a/source/input/keyboard.cpp b/source/input/keyboard.cpp index 1d7bb65..344048e 100644 --- a/source/input/keyboard.cpp +++ b/source/input/keyboard.cpp @@ -1,12 +1,10 @@ -/* $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" @@ -15,15 +13,15 @@ Distributed under the LGPL 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 @@ -31,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_VSC); + 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;