X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Froot.cpp;h=224e5bc30ef3a975fb022da83a6ba19e4be64779;hb=48fd4db84c4d0b43305d85f74de99eb4fef04fd6;hp=bb3913c73fbf5db85fc85217a98dce872417666a;hpb=8ffcd589660022f05d8b3b1dbb36c0c0aa91954a;p=libs%2Fgltk.git diff --git a/source/root.cpp b/source/root.cpp index bb3913c..224e5bc 100644 --- a/source/root.cpp +++ b/source/root.cpp @@ -21,26 +21,47 @@ Root::Root(Resources &r, Graphics::Window &w): 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)); - window.signal_key_release.connect(sigc::mem_fun(this, &Root::key_release)); + 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)); } void Root::button_press_event(int x, int y, unsigned btn, unsigned) { - translate_coords(x, y); - button_press(x, y, btn); + if(visible) + { + translate_coords(x, y); + button_press(x, y, btn); + } } void Root::button_release_event(int x, int y, unsigned btn, unsigned) { - translate_coords(x, y); - button_release(x, y, btn); + if(visible) + { + translate_coords(x, y); + button_release(x, y, btn); + } } void Root::pointer_motion_event(int x, int y) { - translate_coords(x, y); - pointer_motion(x, y); + if(visible) + { + translate_coords(x, y); + pointer_motion(x, y); + } +} + +void Root::key_press_event(unsigned key, unsigned mod, wchar_t ch) +{ + if(visible) + key_press(key, mod, ch); +} + +void Root::key_release_event(unsigned key, unsigned mod) +{ + if(visible) + key_release(key, mod); } void Root::translate_coords(int &x, int &y)