diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-03-17 11:08:02 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2022-03-17 11:08:02 +0100 |
| commit | 618eb8f105e131052c2ed206bf4f271f2f9acf45 (patch) | |
| tree | 757f351786926629781e8aa8afe6dba3a5638e2e | |
| parent | b12ec7d75ea7be7da3176592aa5cfc29ffd038bd (diff) | |
Improve handling of custom cursor by Wayland platform.
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 33 |
1 files changed, 15 insertions, 18 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx index f4ba06d56..458435756 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx @@ -242,29 +242,25 @@ static void pointer_enter(void *data, wl_fixed_t surface_x, wl_fixed_t surface_y) { - struct seat *seat = (struct seat*)data; Fl_Window *win = Fl_Wayland_Screen_Driver::surface_to_window(surface); - struct wl_cursor *cursor = NULL; - if (win) { // use custom cursor if present - Fl_Wayland_Window_Driver *driver = Fl_Wayland_Window_Driver::driver(win); + if (!win) return; + Fl_Wayland_Window_Driver *driver = Fl_Wayland_Window_Driver::driver(win); + struct wl_cursor *cursor = driver->cursor(); // use custom cursor if present + if (win->parent() && !cursor) { + driver = Fl_Wayland_Window_Driver::driver(win->top_window()); cursor = driver->cursor(); - if (win->parent() && !cursor) { - driver = Fl_Wayland_Window_Driver::driver(win->top_window()); - cursor = driver->cursor(); - } } + struct seat *seat = (struct seat*)data; do_set_cursor(seat, cursor); seat->serial = serial; - if (win) { - float f = Fl::screen_scale(win->screen_num()); - Fl::e_x = wl_fixed_to_int(surface_x) / f; - Fl::e_x_root = Fl::e_x + win->x(); - Fl::e_y = wl_fixed_to_int(surface_y) / f; - Fl::e_y_root = Fl::e_y + win->y(); - set_event_xy(win); - Fl::handle(FL_ENTER, win); -//fprintf(stderr, "pointer_enter window=%p\n", win); - } + float f = Fl::screen_scale(win->screen_num()); + Fl::e_x = wl_fixed_to_int(surface_x) / f; + Fl::e_x_root = Fl::e_x + win->x(); + Fl::e_y = wl_fixed_to_int(surface_y) / f; + Fl::e_y_root = Fl::e_y + win->y(); + set_event_xy(win); + Fl::handle(FL_ENTER, win); + //fprintf(stderr, "pointer_enter window=%p\n", win); seat->pointer_focus = surface; } @@ -1391,6 +1387,7 @@ struct wl_cursor *Fl_Wayland_Screen_Driver::default_cursor() { void Fl_Wayland_Screen_Driver::default_cursor(struct wl_cursor *cursor) { seat->default_cursor = cursor; + do_set_cursor(seat); } struct wl_cursor *Fl_Wayland_Screen_Driver::cache_cursor(const char *cursor_name) { |
