Remove special FL_CURSOR_NONE implementation in Wayland

This commit is contained in:
ManoloFLTK 2023-02-17 16:24:30 +01:00
parent 4a3781eb0e
commit 2af43ef4c8
4 changed files with 2 additions and 20 deletions

View File

@ -415,7 +415,7 @@ function <tt>Fl_Wayland_Window_Driver::set_cursor(const Fl_RGB_Image *,…)</tt>
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 <tt>struct wl_shm_pool</tt> 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

View File

@ -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:

View File

@ -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() {

View File

@ -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;