From 2af43ef4c809bdef49789db28b1fee9ccb272a5a Mon Sep 17 00:00:00 2001
From: ManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>
Date: Fri, 17 Feb 2023 16:24:30 +0100
Subject: [PATCH] Remove special FL_CURSOR_NONE implementation in Wayland
---
documentation/src/wayland.dox | 9 +--------
src/drivers/Wayland/Fl_Wayland_Screen_Driver.H | 1 -
src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx | 2 +-
src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx | 10 ----------
4 files changed, 2 insertions(+), 20 deletions(-)
diff --git a/documentation/src/wayland.dox b/documentation/src/wayland.dox
index b6dbb42c1..8026ce5a9 100644
--- a/documentation/src/wayland.dox
+++ b/documentation/src/wayland.dox
@@ -415,7 +415,7 @@ function Fl_Wayland_Window_Driver::set_cursor(const Fl_RGB_Image *,…)
use their own "buffer factory" inside Wayland functions such as \c wl_cursor_theme_get_cursor().
Therefore, the fact that the \c wl_buffer objects behind standard cursors are never destroyed
doesn't prevent disused struct wl_shm_pool objects from being freed because those
-buffers come a distinct "buffer factory".
+buffers come from a distinct "buffer factory".
The "buffer factory" described here is also used by function \c offscreen_from_text() when
displaying dragged text in a DnD operation.
@@ -526,13 +526,6 @@ is stored in member \c custom_cursor of the window's \ref wld_window. Member fun
occurs when a window associated to a custom cursor is un-mapped and when such a window gets
associated to a standard cursor or to a new custom cursor.
-The \c FL_CURSOR_NONE cursor shape is normally implemented by FLTK as a custom cursor shape in
-function \c fallback_cursor() of file \c src/fl_cursor.cxx. Because both FLTK classes \c Fl_Input and
-\c Fl_Text_Editor often use \c FL_CURSOR_NONE, FLTK's Wayland backend uses an additional piece of
-code to avoid the construction of a new \c wl_cursor object each time \c FL_CURSOR_NONE is set:
-function \c Fl_Wayland_Window_Driver::set_cursor(Fl_Cursor) creates a null-shaped \c wl_cursor
-object the first time it's called with argument \c FL_CURSOR_NONE and stores it in member \c xc_none
-of the \c Fl_Wayland_Screen_Driver object, allowing later re-use of this cursor object.
\section wayland-text Text input
diff --git a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
index f0bf11431..94640afce 100644
--- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
+++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.H
@@ -91,7 +91,6 @@ 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_Screen_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
index 281724e9a..8279736ca 100644
--- a/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Screen_Driver.cxx
@@ -1452,7 +1452,7 @@ struct wl_cursor *Fl_Wayland_Screen_Driver::cache_cursor(const char *cursor_name
void Fl_Wayland_Screen_Driver::reset_cursor() {
xc_arrow = xc_ns = xc_wait = xc_insert = xc_hand = xc_help = xc_cross = xc_move =
xc_north = xc_south = xc_west = xc_east = xc_we = xc_nesw = xc_nwse = xc_sw = xc_se =
- xc_ne = xc_nw = xc_none = NULL;
+ xc_ne = xc_nw = NULL;
}
uint32_t Fl_Wayland_Screen_Driver::get_serial() {
diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
index a23ae5653..641b397e5 100644
--- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
@@ -1402,16 +1402,6 @@ 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) {
- static const uchar pixel[] = {0, 0, 0, 0};
- Fl_RGB_Image image(pixel, 1, 1, 4);
- this->set_cursor(&image, 0, 0);
- scr_driver->xc_none = xid->custom_cursor;
- xid->custom_cursor = NULL;
- }
- scr_driver->default_cursor(scr_driver->xc_none);
- break;
default:
return 0;