X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Fsystemkeyboardinput.cpp;fp=source%2Fsystemkeyboardinput.cpp;h=cedddd1817d170b21c6f34eb3ac7fec07d3951ec;hb=4b52d16bc895f9d969383d7a7d6a3558c1972cc5;hp=0000000000000000000000000000000000000000;hpb=6d73e04329fc3752552773e4d11d7374caf779f6;p=libs%2Fgltk.git diff --git a/source/systemkeyboardinput.cpp b/source/systemkeyboardinput.cpp new file mode 100644 index 0000000..cedddd1 --- /dev/null +++ b/source/systemkeyboardinput.cpp @@ -0,0 +1,37 @@ +#include +#include "root.h" +#include "systemkeyboardinput.h" + +namespace Msp { +namespace GLtk { + +SystemKeyboardInput::SystemKeyboardInput(Root &r, Input::Keyboard &k): + InputMethod(r), + keyboard(k) +{ + keyboard.signal_button_press.connect(sigc::mem_fun(this, &SystemKeyboardInput::key_press)); + keyboard.signal_button_release.connect(sigc::mem_fun(this, &SystemKeyboardInput::key_release)); + keyboard.signal_character.connect(sigc::mem_fun(this, &SystemKeyboardInput::character)); +} + +bool SystemKeyboardInput::key_press(unsigned key) +{ + // TODO modifiers + if(root.key_press(key, 0)) + return true; + + return false; +} + +bool SystemKeyboardInput::key_release(unsigned key) +{ + return root.key_release(key, 0); +} + +bool SystemKeyboardInput::character(StringCodec::unichar ch) +{ + return root.character(ch); +} + +} // namespace GLtk +} // namespace Msp