diff options
| author | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2023-02-11 14:36:58 +0100 |
|---|---|---|
| committer | ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com> | 2023-02-11 14:36:58 +0100 |
| commit | 740c56ce15935628ac6d613e582454c48adb978e (patch) | |
| tree | e8f8034e16ace30cc3a6828928c2a46ac08adcfa /src | |
| parent | d9b519f969c57e2b5eb73ad212a4382ea54cb3e4 (diff) | |
Wayland: improve support for FL_CURSOR_{NONE, HELP}
Diffstat (limited to 'src')
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Screen_Driver.H | 3 | ||||
| -rw-r--r-- | src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx | 22 |
2 files changed, 23 insertions, 2 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H index f1a723926..06545165d 100644 --- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H +++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H @@ -2,7 +2,7 @@ // Definition of X11 Screen interface // for the Fast Light Tool Kit (FLTK). // -// Copyright 2010-2022 by Bill Spitzak and others. +// Copyright 2010-2023 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -91,6 +91,7 @@ public: struct wl_cursor *xc_se; struct wl_cursor *xc_ne; struct wl_cursor *xc_nw; + struct wl_cursor *xc_none; static const struct wl_data_device_listener *p_data_device_listener; public: diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx index 26c00f10c..55f54d275 100644 --- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx +++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx @@ -22,6 +22,8 @@ #include <FL/filename.H> #include <wayland-cursor.h> #include "../../../libdecor/src/libdecor.h" +#include "../../fl_cursor_none.xpm" +#include "../../fl_cursor_help.xpm" #include "xdg-shell-client-protocol.h" #include <pango/pangocairo.h> #include <FL/Fl_Overlay_Window.H> @@ -1337,7 +1339,14 @@ int Fl_Wayland_Window_Driver::set_cursor(Fl_Cursor c) { break; case FL_CURSOR_HELP: if (!scr_driver->xc_help) scr_driver->xc_help = scr_driver->cache_cursor("help"); - if (!scr_driver->xc_help) return 0; + if (!scr_driver->xc_help) { + const char **xpm = (const char**)fl_cursor_help_xpm; + Fl_Pixmap pxm(xpm); + Fl_RGB_Image image(&pxm); + this->set_cursor(&image, 1, 3); + scr_driver->xc_help = this->cursor_; + this->cursor_ = NULL; + } scr_driver->default_cursor(scr_driver->xc_help); break; case FL_CURSOR_MOVE: @@ -1400,6 +1409,17 @@ int Fl_Wayland_Window_Driver::set_cursor(Fl_Cursor c) { if (!scr_driver->xc_nw) return 0; scr_driver->default_cursor(scr_driver->xc_nw); break; + case FL_CURSOR_NONE: + if (!scr_driver->xc_none) { + const char **xpm = (const char**)fl_cursor_none_xpm; + Fl_Pixmap pxm(xpm); + Fl_RGB_Image image(&pxm); + this->set_cursor(&image, 0, 0); + scr_driver->xc_none = this->cursor_; + this->cursor_ = NULL; + } + scr_driver->default_cursor(scr_driver->xc_none); + break; default: return 0; |
