summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2024-02-09 10:04:13 +0100
committerManoloFLTK <41016272+ManoloFLTK@users.noreply.github.com>2024-02-09 10:04:13 +0100
commitfc6d36405718e19946ba0b4c96dcbbb39b456eee (patch)
tree8dbc17c7e3002b4d6057b7c2c5af93fbbb6c1552 /src
parentc83164fbcc7330ae7e2a8b6d1e5b4d32023109c7 (diff)
Change parameters of Fl_Wayland_Window_Driver::delete_cursor()
Diffstat (limited to 'src')
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Window_Driver.H14
-rw-r--r--src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx58
2 files changed, 36 insertions, 36 deletions
diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.H b/src/drivers/Wayland/Fl_Wayland_Window_Driver.H
index e0eca821e..192d82f5a 100644
--- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.H
+++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.H
@@ -59,7 +59,6 @@ private:
cairo_rectangle_int_t *subRect_; // makes sure subwindow remains inside its parent window
static bool in_flush_; // useful for progressive window drawing
Fl_Cursor standard_cursor_; // window's standard custom kind
- void delete_cursor_(bool delete_rgb = true);
struct gl_start_support *gl_start_support_; // for support of gl_start/gl_finish
bool is_popup_window_;
public:
@@ -74,6 +73,12 @@ public:
struct Fl_Wayland_Screen_Driver::output *output;
struct wl_list link;
};
+ struct custom_cursor {
+ struct wl_cursor *wl_cursor;
+ const Fl_RGB_Image *rgb;
+ int hotx, hoty;
+ };
+ static void delete_cursor(struct custom_cursor *custom, bool delete_rgb = true);
static type_for_resize_window_between_screens data_for_resize_window_between_screens_;
void decorated_win_size(int &w, int &h);
void shape_bitmap_(Fl_Image* b);
@@ -155,11 +160,8 @@ struct wld_window {
struct xdg_popup *xdg_popup;
struct xdg_toplevel *xdg_toplevel;
};
- struct custom_cursor_ {
- struct wl_cursor *wl_cursor;
- const Fl_RGB_Image *rgb;
- int hotx, hoty;
- } *custom_cursor; // non-null when using custom cursor
+ // non-null when using custom cursor
+ struct Fl_Wayland_Window_Driver::custom_cursor *custom_cursor;
int configured_width;
int configured_height;
int floating_width;
diff --git a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
index 055802192..44ffe3037 100644
--- a/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
+++ b/src/drivers/Wayland/Fl_Wayland_Window_Driver.cxx
@@ -72,31 +72,27 @@ Fl_Wayland_Window_Driver::Fl_Wayland_Window_Driver(Fl_Window *win) : Fl_Window_D
}
-void Fl_Wayland_Window_Driver::delete_cursor_(bool delete_rgb) {
- struct wld_window *xid = (struct wld_window *)Fl_Window_Driver::xid(pWindow);
- struct wld_window::custom_cursor_ *custom = xid->custom_cursor;
- if (custom) {
- struct wl_cursor *wl_cursor = custom->wl_cursor;
- struct cursor_image *new_image = (struct cursor_image*)wl_cursor->images[0];
- struct Fl_Wayland_Graphics_Driver::wld_buffer *offscreen =
- (struct Fl_Wayland_Graphics_Driver::wld_buffer *)
- wl_buffer_get_user_data(new_image->buffer);
- struct wld_window fake_xid;
- memset(&fake_xid, 0, sizeof(fake_xid));
- fake_xid.buffer = offscreen;
- Fl_Wayland_Graphics_Driver::buffer_release(&fake_xid);
- free(new_image);
- free(wl_cursor->images);
- free(wl_cursor->name);
- free(wl_cursor);
- Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver();
- if (scr_driver->default_cursor() == wl_cursor) {
- scr_driver->default_cursor(scr_driver->xc_arrow);
- }
- if (delete_rgb) delete custom->rgb;
- delete custom;
- xid->custom_cursor = NULL;
+void Fl_Wayland_Window_Driver::delete_cursor(
+ struct Fl_Wayland_Window_Driver::custom_cursor *custom, bool delete_rgb) {
+ struct wl_cursor *wl_cursor = custom->wl_cursor;
+ struct cursor_image *new_image = (struct cursor_image*)wl_cursor->images[0];
+ struct Fl_Wayland_Graphics_Driver::wld_buffer *offscreen =
+ (struct Fl_Wayland_Graphics_Driver::wld_buffer *)
+ wl_buffer_get_user_data(new_image->buffer);
+ struct wld_window fake_xid;
+ memset(&fake_xid, 0, sizeof(fake_xid));
+ fake_xid.buffer = offscreen;
+ Fl_Wayland_Graphics_Driver::buffer_release(&fake_xid);
+ free(new_image);
+ free(wl_cursor->images);
+ free(wl_cursor->name);
+ free(wl_cursor);
+ Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver();
+ if (scr_driver->default_cursor() == wl_cursor) {
+ scr_driver->default_cursor(scr_driver->xc_arrow);
}
+ if (delete_rgb) delete custom->rgb;
+ delete custom;
}
@@ -453,15 +449,13 @@ void Fl_Wayland_Window_Driver::hide() {
Fl_Screen_Driver::del_transient_window(NULL);
}
Fl_X* ip = Fl_X::flx(pWindow);
- if (!ip) return;
- struct wld_window *wld_win = (struct wld_window*)ip->xid;
- if (wld_win->custom_cursor) delete_cursor_();
if (hide_common()) return;
if (ip->region) {
Fl_Graphics_Driver::default_driver().XDestroyRegion(ip->region);
ip->region = 0;
}
screen_num_ = -1;
+ struct wld_window *wld_win = (struct wld_window*)ip->xid;
if (wld_win) { // this test makes sure ip->xid has not been destroyed already
Fl_Wayland_Graphics_Driver::buffer_release(wld_win);
if (wld_win->kind == SUBWINDOW && wld_win->subsurface) {
@@ -486,6 +480,7 @@ void Fl_Wayland_Window_Driver::hide() {
wld_win->xdg_surface = NULL;
}
}
+ if (wld_win->custom_cursor) delete_cursor(wld_win->custom_cursor);
if (wld_win->wl_surface) {
Fl_Wayland_Screen_Driver *scr_driver = (Fl_Wayland_Screen_Driver*)Fl::screen_driver();
destroy_surface_caution_pointer_focus(wld_win->wl_surface, scr_driver->seat);
@@ -1679,7 +1674,10 @@ int Fl_Wayland_Window_Driver::set_cursor(Fl_Cursor c) {
default:
return 0;
}
- if (xid->custom_cursor) delete_cursor_();
+ if (xid->custom_cursor) {
+ delete_cursor(xid->custom_cursor);
+ xid->custom_cursor = NULL;
+ }
standard_cursor_ = c;
scr_driver->set_cursor();
return 1;
@@ -1799,9 +1797,9 @@ int Fl_Wayland_Window_Driver::set_cursor_4args(const Fl_RGB_Image *rgb, int hotx
memcpy(offscreen->data, offscreen->draw_buffer.buffer, offscreen->draw_buffer.data_size);
// delete the previous custom cursor, if there was one,
// and keep its Fl_RGB_Image if appropriate
- delete_cursor_(keep_copy);
+ if (xid->custom_cursor) delete_cursor(xid->custom_cursor, keep_copy);
//have this new cursor used
- xid->custom_cursor = new wld_window::custom_cursor_;
+ xid->custom_cursor = new custom_cursor;
xid->custom_cursor->wl_cursor = new_cursor;
xid->custom_cursor->rgb = rgb;
xid->custom_cursor->hotx = hotx;