|
|
Hello
Sorry for the weakly descriptive title.
Given the following program:
#include <FL/Enumerations.H>
#include <FL/Fl.H>
#include <FL/Fl_Window.H>
// #include <FL/Fl_Group.H>
struct Embed : public Fl_Window {
Embed(int x, int y, int w, int h, const char *title = 0)
: Fl_Window(x, y, w, h, title) {}
int handle(int e) {
switch (e) {
case FL_PUSH:
printf("%d, %d\n", Fl::event_x(), Fl::event_y());
fflush(stdout);
break;
case FL_MOUSEWHEEL:
printf("%d, %d\n", Fl::event_x(), Fl::event_y());
fflush(stdout);
break;
}
return Fl_Window::handle(e);
}
};
int main() {
Fl_Window win(100, 100, 400, 300);
Embed embed(0, 0, 400, 300);
win.end();
win.show();
win.redraw();
return Fl::run();
}
For an embedded window, the values retrieved from Fl::event_x() and Fl::event_y() differ depending on the event. If we change Embed to derive from Fl_Group, then the values are correct. Also the values of Fl::event_x_root() and Fl::event_y_root() are correct.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or unsubscribe.
[ Direct Link to Message ] | |
|
| |