Fix: Wayland sends wrong events after an FL_DRAG of a top window (#983)

This commit is contained in:
ManoloFLTK 2024-05-28 15:33:33 +02:00
parent f3f69b892d
commit 9c8977eff1
3 changed files with 8 additions and 0 deletions

View File

@ -87,6 +87,7 @@ public:
// next length of marked text after current marked text will have been replaced
static int next_marked_length;
static compositor_name compositor; // identifies the used Wayland compositor
static bool in_xdg_toplevel_move; // true when performing interactive window move
// static member functions
static void insertion_point_location(int x, int y, int height);

View File

@ -96,6 +96,7 @@ static struct wl_surface *gtk_shell_surface = NULL;
Fl_Wayland_Screen_Driver::compositor_name Fl_Wayland_Screen_Driver::compositor =
Fl_Wayland_Screen_Driver::unspecified;
bool Fl_Wayland_Screen_Driver::in_xdg_toplevel_move = false;
extern "C" {
bool fl_libdecor_using_weston(void) {
@ -230,6 +231,11 @@ static void pointer_enter(void *data, struct wl_pointer *wl_pointer, uint32_t se
set_event_xy(win);
Fl::handle(FL_ENTER, win);
//fprintf(stderr, "pointer_enter window=%p\n", win);
if (Fl_Wayland_Screen_Driver::in_xdg_toplevel_move) {
Fl::pushed(NULL);
Fl::e_state = 0;
Fl_Wayland_Screen_Driver::in_xdg_toplevel_move = false;
}
seat->pointer_focus = surface;
}

View File

@ -1856,6 +1856,7 @@ void Fl_Wayland_Window_Driver::resize(int X, int Y, int W, int H) {
Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver();
if (Fl::e_state == FL_BUTTON1) {
xdg_toplevel_move(xdg_toplevel(), scr_driver->seat->wl_seat, scr_driver->seat->serial);
Fl_Wayland_Screen_Driver::in_xdg_toplevel_move = true;
}
} else if (fl_win->kind == SUBWINDOW && fl_win->subsurface) {
wl_subsurface_set_position(fl_win->subsurface, pWindow->x() * f, pWindow->y() * f);