From c1327e2c1b4762f3957cea69ca0af154004695bd Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sat, 20 Apr 2024 07:37:40 -0400 Subject: [PATCH] gdk: Deprecate public cursor theme setters No need for this api, we've made the frontend setter private for a reason. --- gdk/wayland/gdkdisplay-wayland.c | 18 ++++++++++++++++-- gdk/wayland/gdkwaylanddisplay.h | 4 ++-- gdk/x11/gdkcursor-x11.c | 11 +++++++++++ gdk/x11/gdkdisplay-x11.c | 2 +- gdk/x11/gdkprivate-x11.h | 4 ++++ gdk/x11/gdkx11display.h | 2 +- 6 files changed, 35 insertions(+), 6 deletions(-) diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index 7cff83ce22a..17278cbb99c 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -105,6 +105,9 @@ #endif static void _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland); +static void _gdk_wayland_display_set_cursor_theme (GdkDisplay *display, + const char *name, + int size); G_DEFINE_TYPE (GdkWaylandDisplay, gdk_wayland_display, GDK_TYPE_DISPLAY) @@ -1129,7 +1132,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS display_class->get_monitors = gdk_wayland_display_get_monitors; display_class->get_monitor_at_surface = gdk_wayland_display_get_monitor_at_surface; display_class->get_setting = gdk_wayland_display_get_setting; - display_class->set_cursor_theme = gdk_wayland_display_set_cursor_theme; + display_class->set_cursor_theme = _gdk_wayland_display_set_cursor_theme; } static void @@ -1202,11 +1205,22 @@ get_cursor_theme (GdkWaylandDisplay *display_wayland, * @size: the size to use for cursors * * Sets the cursor theme for the given @display. + * + * Deprecated: 4.16: Use the cursor-related properties of + * [GtkSettings](../gtk4/class.Settings.html) to set the cursor theme */ void gdk_wayland_display_set_cursor_theme (GdkDisplay *display, const char *name, int size) +{ + _gdk_wayland_display_set_cursor_theme (display, name, size); +} + +static void +_gdk_wayland_display_set_cursor_theme (GdkDisplay *display, + const char *name, + int size) { GdkWaylandDisplay *display_wayland = GDK_WAYLAND_DISPLAY(display); struct wl_cursor_theme *theme; @@ -1275,7 +1289,7 @@ _gdk_wayland_display_load_cursor_theme (GdkWaylandDisplay *display_wayland) else name = "default"; - gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (display_wayland), name, size); + _gdk_wayland_display_set_cursor_theme (GDK_DISPLAY (display_wayland), name, size); g_value_unset (&v); gdk_profiler_end_mark (before, "Wayland cursor theme load", NULL); diff --git a/gdk/wayland/gdkwaylanddisplay.h b/gdk/wayland/gdkwaylanddisplay.h index 5e5d2945dcf..396a6f98f21 100644 --- a/gdk/wayland/gdkwaylanddisplay.h +++ b/gdk/wayland/gdkwaylanddisplay.h @@ -48,7 +48,7 @@ GDK_AVAILABLE_IN_ALL struct wl_display *gdk_wayland_display_get_wl_display (GdkDisplay *display); GDK_AVAILABLE_IN_ALL struct wl_compositor *gdk_wayland_display_get_wl_compositor (GdkDisplay *display); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_16 void gdk_wayland_display_set_cursor_theme (GdkDisplay *display, const char *name, int size); @@ -60,7 +60,7 @@ void gdk_wayland_display_set_startup_notification_id (GdkDisp GDK_AVAILABLE_IN_ALL gboolean gdk_wayland_display_query_registry (GdkDisplay *display, - const char *global); + const char *global); GDK_AVAILABLE_IN_4_4 gpointer gdk_wayland_display_get_egl_display (GdkDisplay *display); diff --git a/gdk/x11/gdkcursor-x11.c b/gdk/x11/gdkcursor-x11.c index 04603efbe60..c5a14e8c49b 100644 --- a/gdk/x11/gdkcursor-x11.c +++ b/gdk/x11/gdkcursor-x11.c @@ -274,11 +274,22 @@ gdk_x11_cursor_create_for_name (GdkDisplay *display, * will have to be handled by the application (GTK applications can learn * about cursor theme changes by listening for change notification * for the corresponding `GtkSetting`). + * + * Deprecated: 4.16: Use the cursor-related properties of + * [GtkSettings](../gtk4/class.Settings.html) to set the cursor theme */ void gdk_x11_display_set_cursor_theme (GdkDisplay *display, const char *theme, const int size) +{ + _gdk_x11_display_set_cursor_theme (display, theme, size); +} + +void +_gdk_x11_display_set_cursor_theme (GdkDisplay *display, + const char *theme, + const int size) { #if defined(HAVE_XCURSOR) && defined(HAVE_XFIXES) && XFIXES_MAJOR >= 2 GdkX11Screen *x11_screen; diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index 4e24acc33bb..b80256cb507 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -3078,7 +3078,7 @@ G_GNUC_END_IGNORE_DEPRECATIONS display_class->get_monitors = gdk_x11_display_get_monitors; display_class->get_setting = gdk_x11_display_get_setting; - display_class->set_cursor_theme = gdk_x11_display_set_cursor_theme; + display_class->set_cursor_theme = _gdk_x11_display_set_cursor_theme; class->xevent = gdk_event_source_xevent; diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h index d60b97f6b6c..358da4ebc50 100644 --- a/gdk/x11/gdkprivate-x11.h +++ b/gdk/x11/gdkprivate-x11.h @@ -206,6 +206,10 @@ GdkFilterReturn gdk_surface_cache_shape_filter (const XEvent *xevent, gpointer data); +void _gdk_x11_display_set_cursor_theme (GdkDisplay *display, + const char *theme, + const int size); + void _gdk_x11_cursor_display_finalize (GdkDisplay *display); void _gdk_x11_surface_register_dnd (GdkSurface *window); diff --git a/gdk/x11/gdkx11display.h b/gdk/x11/gdkx11display.h index 2df0c488990..0b07e393719 100644 --- a/gdk/x11/gdkx11display.h +++ b/gdk/x11/gdkx11display.h @@ -88,7 +88,7 @@ GDK_AVAILABLE_IN_ALL void gdk_x11_display_set_program_class (GdkDisplay *display, const char *program_class); -GDK_AVAILABLE_IN_ALL +GDK_DEPRECATED_IN_4_16 void gdk_x11_display_set_cursor_theme (GdkDisplay *display, const char *theme, const int size); -- GitLab