-
Notifications
You must be signed in to change notification settings - Fork 316
Description
Description of the Bug Report
Admittedly a special case: a program with subwindow in it, that is hidden when the mouse leaves the window and shown again when the mouse enters the window.
I see an unexpected FL_ENTER event after the FL_LEAVE, when the subwindow is hidden from within the handle() method. This event is triggered obviously by the hide of the subwindow and is immediately (recursing) sent to the handle() method which still is handling the FL_LEAVE event.
To Reproduce
#include <FL/Fl.H>
#include <FL/Fl_Double_Window.H>
class AppWindow : public Fl_Double_Window {
typedef Fl_Double_Window Inherited;
public:
AppWindow(int w_, int h_, const char *title_) :
Inherited(w_, h_, title_) {
}
int handle(int e_) {
int ret = Inherited::handle(e_);
if (e_ == FL_ENTER) {
static int id = 0;
id++;
printf("\n<FL_ENTER [%d]: show subwin\n", id);
child(0)->show();
printf(" FL_ENTER [%d]/>\n", id);
}
if (e_ == FL_LEAVE) {
static int id = 0;
id++;
printf("\n<FL_LEAVE [%d]: hide subwin\n", id);
child(0)->hide();
printf(" FL_LEAVE [%d]/>\n", id);
}
return ret;
}
};
int main() {
AppWindow win(200, 200, "App");
Fl_Double_Window subwin(10, 10, win.w()-20, win.h()-20);
subwin.color(FL_YELLOW);
subwin.end();
win.resizable(&win);
subwin.hide();
win.show();
return Fl::run();
}
Steps to reproduce the behavior:
- Run the program under an x11 session (or FLTK_BACKEND=x11).
- Enter the window with the mouse ==> the yellow subwindow is shown
- Leave the window with the mouse ==> the yellow subwindow is hidden
- This should be repeatable over and over, but it stalls after the first cycle.
Expected behavior
IMHO it should not send an FL_ENTER event, because the mouse is definitely outside of the window.
It should not repeat events under Wayland (see below).
It should work like it does under X11 with FLTK 1.3.11.
FLTK Version
GH current and FLTK 1.4
Operating System / Platform:
- OS: Linux, Ubuntu 24.04
Linux/Unix Runtime, if applicable:
- Wayland
- X11
Additional context
Under a wayland session the program seems to work, but under the hood the FL_ENTER event is sent all over the time, when the mouse is in the window.
Under FLTK 1.3.11 the program works as expected.