From 2a60928157c246250b36a2e5f83a27d10e8b186e Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Wed, 1 Nov 2017 21:47:35 -0400 Subject: t Remove gdk_cursor_new_for_display The preferred api to create cursors is by name, and the GdkCursorType enumeration can directly trace its ancestry to the horrible X cursor font. So lets stop using it. --- docs/reference/gdk/gdk4-sections.txt | 2 -- gdk/broadway/gdkdisplay-broadway.c | 1 - gdk/gdkcursor.c | 38 -------------------------- gdk/gdkcursor.h | 5 ---- gdk/gdkdisplayprivate.h | 2 -- gdk/quartz/gdkdisplay-quartz.c | 1 - gdk/wayland/gdkdisplay-wayland.c | 1 - gdk/win32/gdkdisplay-win32.c | 1 - gdk/x11/gdkcursor-x11.c | 53 +++--------------------------------- gdk/x11/gdkdisplay-x11.c | 1 - gdk/x11/gdkprivate-x11.h | 2 -- 11 files changed, 4 insertions(+), 103 deletions(-) diff --git a/docs/reference/gdk/gdk4-sections.txt b/docs/reference/gdk/gdk4-sections.txt index 76e35ce367..29ee2f9342 100644 --- a/docs/reference/gdk/gdk4-sections.txt +++ b/docs/reference/gdk/gdk4-sections.txt @@ -814,11 +814,9 @@ GdkCursorType gdk_cursor_new_from_pixbuf gdk_cursor_new_from_surface gdk_cursor_new_from_name -gdk_cursor_new_for_display gdk_cursor_get_display gdk_cursor_get_image gdk_cursor_get_surface -gdk_cursor_get_cursor_type GDK_TYPE_CURSOR_TYPE diff --git a/gdk/broadway/gdkdisplay-broadway.c b/gdk/broadway/gdkdisplay-broadway.c index 8dabb86ee5..78db641bc6 100644 --- a/gdk/broadway/gdkdisplay-broadway.c +++ b/gdk/broadway/gdkdisplay-broadway.c @@ -358,7 +358,6 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class) display_class->store_clipboard = gdk_broadway_display_store_clipboard; display_class->supports_shapes = gdk_broadway_display_supports_shapes; display_class->supports_input_shapes = gdk_broadway_display_supports_input_shapes; - display_class->get_cursor_for_type = _gdk_broadway_display_get_cursor_for_type; display_class->get_cursor_for_name = _gdk_broadway_display_get_cursor_for_name; display_class->get_cursor_for_surface = _gdk_broadway_display_get_cursor_for_surface; display_class->get_default_cursor_size = _gdk_broadway_display_get_default_cursor_size; diff --git a/gdk/gdkcursor.c b/gdk/gdkcursor.c index 03d597bb9f..1110efdaa7 100644 --- a/gdk/gdkcursor.c +++ b/gdk/gdkcursor.c @@ -147,44 +147,6 @@ gdk_cursor_init (GdkCursor *cursor) { } -/** - * gdk_cursor_get_cursor_type: - * @cursor: a #GdkCursor - * - * Returns the cursor type for this cursor. - * - * Returns: a #GdkCursorType - * - * Since: 2.22 - **/ -GdkCursorType -gdk_cursor_get_cursor_type (GdkCursor *cursor) -{ - g_return_val_if_fail (cursor != NULL, GDK_BLANK_CURSOR); - - return cursor->type; -} - -/** - * gdk_cursor_new_for_display: - * @display: the #GdkDisplay for which the cursor will be created - * @cursor_type: cursor to create - * - * Creates a new cursor from the set of builtin cursors. - * - * Returns: a new #GdkCursor - * - * Since: 2.2 - **/ -GdkCursor* -gdk_cursor_new_for_display (GdkDisplay *display, - GdkCursorType cursor_type) -{ - g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL); - - return GDK_DISPLAY_GET_CLASS (display)->get_cursor_for_type (display, cursor_type); -} - /** * gdk_cursor_new_from_name: * @display: the #GdkDisplay for which the cursor will be created diff --git a/gdk/gdkcursor.h b/gdk/gdkcursor.h index 45c68171b2..74abbe9f67 100644 --- a/gdk/gdkcursor.h +++ b/gdk/gdkcursor.h @@ -221,9 +221,6 @@ typedef enum GDK_AVAILABLE_IN_ALL GType gdk_cursor_get_type (void) G_GNUC_CONST; -GDK_AVAILABLE_IN_ALL -GdkCursor* gdk_cursor_new_for_display (GdkDisplay *display, - GdkCursorType cursor_type); GDK_AVAILABLE_IN_ALL GdkCursor* gdk_cursor_new_from_pixbuf (GdkDisplay *display, GdkPixbuf *pixbuf, @@ -245,8 +242,6 @@ GDK_AVAILABLE_IN_3_10 cairo_surface_t *gdk_cursor_get_surface (GdkCursor *cursor, gdouble *x_hot, gdouble *y_hot); -GDK_AVAILABLE_IN_ALL -GdkCursorType gdk_cursor_get_cursor_type (GdkCursor *cursor); G_END_DECLS diff --git a/gdk/gdkdisplayprivate.h b/gdk/gdkdisplayprivate.h index 0215e0db2a..3da44a2e16 100644 --- a/gdk/gdkdisplayprivate.h +++ b/gdk/gdkdisplayprivate.h @@ -145,8 +145,6 @@ struct _GdkDisplayClass void (*get_maximal_cursor_size) (GdkDisplay *display, guint *width, guint *height); - GdkCursor * (*get_cursor_for_type) (GdkDisplay *display, - GdkCursorType type); GdkCursor * (*get_cursor_for_name) (GdkDisplay *display, const gchar *name); GdkCursor * (*get_cursor_for_surface) (GdkDisplay *display, diff --git a/gdk/quartz/gdkdisplay-quartz.c b/gdk/quartz/gdkdisplay-quartz.c index c37a5e8ae1..77752accdd 100644 --- a/gdk/quartz/gdkdisplay-quartz.c +++ b/gdk/quartz/gdkdisplay-quartz.c @@ -272,7 +272,6 @@ gdk_quartz_display_class_init (GdkQuartzDisplayClass *class) display_class->store_clipboard = gdk_quartz_display_store_clipboard; display_class->supports_shapes = gdk_quartz_display_supports_shapes; display_class->supports_input_shapes = gdk_quartz_display_supports_input_shapes; - display_class->get_cursor_for_type = _gdk_quartz_display_get_cursor_for_type; display_class->get_cursor_for_name = _gdk_quartz_display_get_cursor_for_name; display_class->get_cursor_for_surface = _gdk_quartz_display_get_cursor_for_surface; display_class->get_default_cursor_size = _gdk_quartz_display_get_default_cursor_size; diff --git a/gdk/wayland/gdkdisplay-wayland.c b/gdk/wayland/gdkdisplay-wayland.c index 6d32361ec3..9168268062 100644 --- a/gdk/wayland/gdkdisplay-wayland.c +++ b/gdk/wayland/gdkdisplay-wayland.c @@ -1036,7 +1036,6 @@ gdk_wayland_display_class_init (GdkWaylandDisplayClass *class) display_class->get_app_launch_context = _gdk_wayland_display_get_app_launch_context; display_class->get_default_cursor_size = _gdk_wayland_display_get_default_cursor_size; display_class->get_maximal_cursor_size = _gdk_wayland_display_get_maximal_cursor_size; - display_class->get_cursor_for_type = _gdk_wayland_display_get_cursor_for_type; display_class->get_cursor_for_name = _gdk_wayland_display_get_cursor_for_name; display_class->get_cursor_for_surface = _gdk_wayland_display_get_cursor_for_surface; display_class->supports_cursor_alpha = _gdk_wayland_display_supports_cursor_alpha; diff --git a/gdk/win32/gdkdisplay-win32.c b/gdk/win32/gdkdisplay-win32.c index 2fd9933964..7af465c9d9 100644 --- a/gdk/win32/gdkdisplay-win32.c +++ b/gdk/win32/gdkdisplay-win32.c @@ -1263,7 +1263,6 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass) display_class->supports_input_shapes = gdk_win32_display_supports_input_shapes; //? display_class->get_app_launch_context = _gdk_win32_display_get_app_launch_context; - display_class->get_cursor_for_type = _gdk_win32_display_get_cursor_for_type; display_class->get_cursor_for_name = _gdk_win32_display_get_cursor_for_name; display_class->get_cursor_for_surface = _gdk_win32_display_get_cursor_for_surface; display_class->get_default_cursor_size = _gdk_win32_display_get_default_cursor_size; diff --git a/gdk/x11/gdkcursor-x11.c b/gdk/x11/gdkcursor-x11.c index c3e86a8533..488854c8fa 100644 --- a/gdk/x11/gdkcursor-x11.c +++ b/gdk/x11/gdkcursor-x11.c @@ -237,52 +237,6 @@ get_blank_cursor (GdkDisplay *display) return cursor; } -GdkCursor* -_gdk_x11_display_get_cursor_for_type (GdkDisplay *display, - GdkCursorType cursor_type) -{ - GdkX11Cursor *private; - Cursor xcursor; - - if (gdk_display_is_closed (display)) - { - xcursor = None; - } - else - { - private = find_in_cache (display, cursor_type, NULL); - - if (private) - { - /* Cache had it, add a ref for this user */ - g_object_ref (private); - - return (GdkCursor*) private; - } - else - { - if (cursor_type != GDK_BLANK_CURSOR) - xcursor = XCreateFontCursor (GDK_DISPLAY_XDISPLAY (display), - cursor_type); - else - xcursor = get_blank_cursor (display); - } - } - - private = g_object_new (GDK_TYPE_X11_CURSOR, - "cursor-type", cursor_type, - "display", display, - NULL); - private->xcursor = xcursor; - private->name = NULL; - private->serial = theme_serial; - - if (xcursor != None) - add_to_cache (private); - - return GDK_CURSOR (private); -} - /** * gdk_x11_cursor_get_xdisplay: * @cursor: (type GdkX11Cursor): a #GdkCursor. @@ -672,11 +626,12 @@ _gdk_x11_display_get_cursor_for_name (GdkDisplay *display, { xcursor = None; } + else if (strcmp (name, "none") == 0) + { + xcursor = get_blank_cursor (display); + } else { - if (strcmp (name, "none") == 0) - return _gdk_x11_display_get_cursor_for_type (display, GDK_BLANK_CURSOR); - private = find_in_cache (display, GDK_CURSOR_IS_PIXMAP, name); if (private) diff --git a/gdk/x11/gdkdisplay-x11.c b/gdk/x11/gdkdisplay-x11.c index c40bc97403..c76348f98c 100644 --- a/gdk/x11/gdkdisplay-x11.c +++ b/gdk/x11/gdkdisplay-x11.c @@ -3158,7 +3158,6 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class) display_class->supports_shapes = gdk_x11_display_supports_shapes; display_class->supports_input_shapes = gdk_x11_display_supports_input_shapes; display_class->get_app_launch_context = _gdk_x11_display_get_app_launch_context; - display_class->get_cursor_for_type = _gdk_x11_display_get_cursor_for_type; display_class->get_cursor_for_name = _gdk_x11_display_get_cursor_for_name; display_class->get_cursor_for_surface = _gdk_x11_display_get_cursor_for_surface; display_class->get_default_cursor_size = _gdk_x11_display_get_default_cursor_size; diff --git a/gdk/x11/gdkprivate-x11.h b/gdk/x11/gdkprivate-x11.h index d6550e710e..c4f0e598ea 100644 --- a/gdk/x11/gdkprivate-x11.h +++ b/gdk/x11/gdkprivate-x11.h @@ -230,8 +230,6 @@ GdkAtom _gdk_x11_display_manager_atom_intern (GdkDisplayManager *manager, gchar * _gdk_x11_display_manager_get_atom_name (GdkDisplayManager *manager, GdkAtom atom); -GdkCursor *_gdk_x11_display_get_cursor_for_type (GdkDisplay *display, - GdkCursorType type); GdkCursor *_gdk_x11_display_get_cursor_for_name (GdkDisplay *display, const gchar *name); GdkCursor *_gdk_x11_display_get_cursor_for_surface (GdkDisplay *display, -- cgit v1.2.1