#include "label.h"
#include "style.h"
#include "root.h"
+#include "systemkeyboardinput.h"
namespace Msp {
namespace GLtk {
Root::Root(const Resources &r, Graphics::Window &window):
resources(r),
keyboard(new Input::Keyboard(window)),
+ input_method(0),
mouse(new Input::Mouse(window)),
touchscreen(0),
own_input(true)
Root::Root(const Resources &r, Graphics::Window *window, Input::Keyboard *k, Input::Mouse *m, Input::Touchscreen *t):
resources(r),
keyboard(k),
+ input_method(0),
mouse(m),
touchscreen(t),
own_input(false)
mouse->signal_axis_motion.connect(sigc::mem_fun(this, &Root::axis_motion_event));
}
- if(keyboard)
- {
- keyboard->signal_button_press.connect(sigc::mem_fun(this, &Root::key_press_event));
- keyboard->signal_button_release.connect(sigc::mem_fun(this, &Root::key_release_event));
- keyboard->signal_character.connect(sigc::mem_fun(this, &Root::character_event));
- }
+ if(keyboard && !input_method)
+ input_method = new SystemKeyboardInput(*this, *keyboard);
if(touchscreen)
{
Root::~Root()
{
delete shprog;
+ delete input_method;
if(own_input)
{
delete keyboard;
return false;
}
-bool Root::key_press_event(unsigned key)
-{
- // XXX Modifiers
- if(visible)
- {
- Widget *old_focus = input_focus;
-
- key_press(key, 0);
-
- if(input_focus || old_focus)
- return true;
- }
-
- return false;
-}
-
-bool Root::key_release_event(unsigned key)
-{
- if(visible)
- {
- Widget *old_focus = input_focus;
-
- key_release(key, 0);
-
- if(input_focus || old_focus)
- return true;
- }
-
- return false;
-}
-
-bool Root::character_event(StringCodec::unichar ch)
-{
- if(visible)
- {
- Widget *old_focus = input_focus;
-
- character(ch);
-
- if(input_focus || old_focus)
- return true;
- }
-
- return false;
-}
-
bool Root::touch_press_event(unsigned finger)
{
if(visible)