- window.signal_button_press.connect(sigc::mem_fun(this, &Root::button_press_event));
- window.signal_button_release.connect(sigc::mem_fun(this, &Root::button_release_event));
- window.signal_pointer_motion.connect(sigc::mem_fun(this, &Root::pointer_motion_event));
- window.signal_key_press.connect(sigc::mem_fun(this, &Root::key_press_event));
- window.signal_key_release.connect(sigc::mem_fun(this, &Root::key_release_event));
+ if(mouse)
+ {
+ mouse->signal_button_press.connect(sigc::mem_fun(this, &Root::button_press_event));
+ mouse->signal_button_release.connect(sigc::mem_fun(this, &Root::button_release_event));
+ 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));
+ }
+}
+
+Root::~Root()
+{
+ if(own_input)
+ {
+ delete keyboard;
+ delete mouse;
+ }