X-Git-Url: http://git.tdb.fi/?a=blobdiff_plain;f=source%2Froot.cpp;h=32cd87940fe22e71abcef2769f2c3b6516181005;hb=a38c924ff32081f5cd67c2b0e2d5ca61f0e99de2;hp=83042a63f3c8a62339d40b7ae5708306fef398da;hpb=b23464cda4e4f2c7b69b18549f18c2c893c3fe2d;p=libs%2Fgltk.git diff --git a/source/root.cpp b/source/root.cpp index 83042a6..32cd879 100644 --- a/source/root.cpp +++ b/source/root.cpp @@ -18,18 +18,27 @@ Root::Root(Resources &r, Window &w): void Root::button_press_event(int x, int y, unsigned btn, unsigned) { + 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); } void Root::pointer_motion_event(int x, int y) { + translate_coords(x, y); pointer_motion(x, y); } +void Root::translate_coords(int &x, int &y) +{ + x=x*geom.w/window.get_width(); + y=geom.h-1-y*geom.h/window.get_height(); +} + } // namespace GLtk } // namespace Msp