diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2024-02-03 16:04:06 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2024-02-03 16:04:06 +0100 |
| commit | 865aed4eec521d21af6c5b9b62f356fe62915ce5 (patch) | |
| tree | 10a7f4fb303a8ca3be22ed5df77ec137ec8bd13f | |
| parent | b21a3910a967170c1a022f22ffa8ecb98c308f37 (diff) | |
Wayland: fix setting cursor to FL_NO_CURSOR
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Screen_Driver.H | 3 | ||||
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 12 | ||||
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx | 8 |
3 files changed, 15 insertions, 8 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H index 29756befe..2b9580863 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H @@ -88,7 +88,8 @@ public: static void insertion_point_location(int x, int y, int height); static bool insertion_point_location(int *px, int *py, int *pwidth, int *pheight); static bool own_output(struct wl_output *output); - + static void do_set_cursor(struct Fl_Wayland_Screen_Driver::seat *, + struct wl_cursor *wl_cursor = NULL); // member variables struct wl_cursor *xc_arrow; struct wl_cursor *xc_ns; diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx index 6237cd710..6a4692f64 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx @@ -122,8 +122,8 @@ extern const char *fl_bg2; // end of extern additions workaround -static void do_set_cursor(struct Fl_Wayland_Screen_Driver::seat *seat, - struct wl_cursor *wl_cursor = NULL) { +void Fl_Wayland_Screen_Driver::do_set_cursor( + struct Fl_Wayland_Screen_Driver::seat *seat, struct wl_cursor *wl_cursor) { struct wl_cursor_image *image; struct wl_buffer *buffer; const int scale = seat->pointer_scale; @@ -216,7 +216,7 @@ static void pointer_enter(void *data, struct wl_pointer *wl_pointer, uint32_t se fl_wl_xid(win)->custom_cursor ? fl_wl_xid(win)->custom_cursor->wl_cursor : NULL; struct Fl_Wayland_Screen_Driver::seat *seat = (struct Fl_Wayland_Screen_Driver::seat*)data; - do_set_cursor(seat, cursor); + Fl_Wayland_Screen_Driver::do_set_cursor(seat, cursor); seat->serial = serial; seat->pointer_enter_serial = serial; set_event_xy(win); @@ -382,7 +382,7 @@ static void try_update_cursor(struct Fl_Wayland_Screen_Driver::seat *seat) { if (scale != seat->pointer_scale) { seat->pointer_scale = scale; init_cursors(seat); - do_set_cursor(seat); + Fl_Wayland_Screen_Driver::do_set_cursor(seat); } } @@ -414,7 +414,7 @@ static void cursor_surface_enter(void *data, if (win) { Fl_Wayland_Window_Driver *driver = Fl_Wayland_Window_Driver::driver(win); struct wld_window *xid = fl_wl_xid(win); - if (xid->custom_cursor) do_set_cursor(seat, xid->custom_cursor->wl_cursor); + if (xid->custom_cursor) Fl_Wayland_Screen_Driver::do_set_cursor(seat, xid->custom_cursor->wl_cursor); else if (driver->cursor_default()) driver->set_cursor(driver->cursor_default()); else win->cursor(driver->standard_cursor()); } @@ -437,7 +437,7 @@ static void cursor_surface_leave(void *data, struct wl_surface *wl_surface, Fl_Window *win = Fl::first_window(); if (win) { struct wld_window *xid = fl_wl_xid(win); - if (xid->custom_cursor) do_set_cursor(seat, xid->custom_cursor->wl_cursor); + if (xid->custom_cursor) Fl_Wayland_Screen_Driver::do_set_cursor(seat, xid->custom_cursor->wl_cursor); } } diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx index 1c565fa53..1df53b346 100644 --- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx @@ -1741,7 +1741,13 @@ void Fl_Wayland_Window_Driver::label(const char *name, const char *iname) { int Fl_Wayland_Window_Driver::set_cursor(const Fl_RGB_Image *rgb, int hotx, int hoty) { - return set_cursor_4args(rgb, hotx, hoty, true); + int retval = set_cursor_4args(rgb, hotx, hoty, true); + if (retval) { + Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver(); + struct wld_window *xid = (struct wld_window *)Fl_Window_Driver::xid(pWindow); + Fl_Wayland_Screen_Driver::do_set_cursor(scr_driver->seat, xid->custom_cursor->wl_cursor); + } + return retval; } |
