diff options
| author | Manolo Gouy <Manolo> | 2015-12-01 16:17:37 +0000 |
|---|---|---|
| committer | Manolo Gouy <Manolo> | 2015-12-01 16:17:37 +0000 |
| commit | 597ac17bda5711bb323a508105f29e43b9fb8381 (patch) | |
| tree | cf8f77365c75ca8b7bc5874635b1e8bcec082699 /src/Fl.cxx | |
| parent | f91579545394c97bcc0bc2ea31c840f63eb1a420 (diff) | |
Mac OS: added Fl::event_x_pixel() and Fl::event_y_pixel() that return the mouse event position
in pixel units that differ from FLTK units for OpenGL windows mapped to a retina display.
On non Mac OS platforms, these are synonyms of Fl::event_x() and Fl::event_y().
The example/OpenGL3test demo program is modified to call these new functions.
git-svn-id: file:///fltk/svn/fltk/branches/branch-1.3@10941 ea41ed52-d2ee-0310-a9c1-e6b18d33e121
Diffstat (limited to 'src/Fl.cxx')
| -rw-r--r-- | src/Fl.cxx | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/src/Fl.cxx b/src/Fl.cxx index 357fb55f0..4f4b263fe 100644 --- a/src/Fl.cxx +++ b/src/Fl.cxx @@ -86,6 +86,9 @@ Fl_Widget *Fl::belowmouse_, *Fl::pushed_, *Fl::focus_, *Fl::selection_owner_; +#ifdef __APPLE__ +Fl_Window *Fl::e_window_; // the window relative to which Fl::e_x and Fl::e_y are measured +#endif int Fl::damage_, Fl::e_number, Fl::e_x, @@ -1090,6 +1093,9 @@ void fl_fix_focus() { // send a FL_MOVE event so the enter/leave state is up to date Fl::e_x = Fl::e_x_root-fl_xmousewin->x(); Fl::e_y = Fl::e_y_root-fl_xmousewin->y(); +#ifdef __APPLE__ + Fl::e_window_ = fl_xmousewin; +#endif int old_event = Fl::e_number; w->handle(Fl::e_number = FL_MOVE); Fl::e_number = old_event; @@ -1180,10 +1186,19 @@ static int send_event(int event, Fl_Widget* to, Fl_Window* window) { if (w->type()>=FL_WINDOW) {dx -= w->x(); dy -= w->y();} int save_x = Fl::e_x; Fl::e_x += dx; int save_y = Fl::e_y; Fl::e_y += dy; +#ifdef __APPLE__ + Fl_Window *save_e_window = Fl::e_window_; + if (dx || dy) { + Fl::e_window_ = (to->as_window() ? to->as_window() : to->window()); + } +#endif int ret = to->handle(Fl::e_number = event); Fl::e_number = old_event; Fl::e_y = save_y; Fl::e_x = save_x; +#ifdef __APPLE__ + Fl::e_window_ = save_e_window; +#endif return ret; } |
