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.
This commit is contained in:
Matthias Clasen 2017-11-01 21:47:35 -04:00
parent 47fb329279
commit 2a60928157
11 changed files with 4 additions and 103 deletions

View File

@ -814,11 +814,9 @@ GdkCursorType
gdk_cursor_new_from_pixbuf gdk_cursor_new_from_pixbuf
gdk_cursor_new_from_surface gdk_cursor_new_from_surface
gdk_cursor_new_from_name gdk_cursor_new_from_name
gdk_cursor_new_for_display
gdk_cursor_get_display gdk_cursor_get_display
gdk_cursor_get_image gdk_cursor_get_image
gdk_cursor_get_surface gdk_cursor_get_surface
gdk_cursor_get_cursor_type
<SUBSECTION Standard> <SUBSECTION Standard>
GDK_TYPE_CURSOR_TYPE GDK_TYPE_CURSOR_TYPE

View File

@ -358,7 +358,6 @@ gdk_broadway_display_class_init (GdkBroadwayDisplayClass * class)
display_class->store_clipboard = gdk_broadway_display_store_clipboard; display_class->store_clipboard = gdk_broadway_display_store_clipboard;
display_class->supports_shapes = gdk_broadway_display_supports_shapes; display_class->supports_shapes = gdk_broadway_display_supports_shapes;
display_class->supports_input_shapes = gdk_broadway_display_supports_input_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_name = _gdk_broadway_display_get_cursor_for_name;
display_class->get_cursor_for_surface = _gdk_broadway_display_get_cursor_for_surface; 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; display_class->get_default_cursor_size = _gdk_broadway_display_get_default_cursor_size;

View File

@ -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: * gdk_cursor_new_from_name:
* @display: the #GdkDisplay for which the cursor will be created * @display: the #GdkDisplay for which the cursor will be created

View File

@ -221,9 +221,6 @@ typedef enum
GDK_AVAILABLE_IN_ALL GDK_AVAILABLE_IN_ALL
GType gdk_cursor_get_type (void) G_GNUC_CONST; 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 GDK_AVAILABLE_IN_ALL
GdkCursor* gdk_cursor_new_from_pixbuf (GdkDisplay *display, GdkCursor* gdk_cursor_new_from_pixbuf (GdkDisplay *display,
GdkPixbuf *pixbuf, GdkPixbuf *pixbuf,
@ -245,8 +242,6 @@ GDK_AVAILABLE_IN_3_10
cairo_surface_t *gdk_cursor_get_surface (GdkCursor *cursor, cairo_surface_t *gdk_cursor_get_surface (GdkCursor *cursor,
gdouble *x_hot, gdouble *x_hot,
gdouble *y_hot); gdouble *y_hot);
GDK_AVAILABLE_IN_ALL
GdkCursorType gdk_cursor_get_cursor_type (GdkCursor *cursor);
G_END_DECLS G_END_DECLS

View File

@ -145,8 +145,6 @@ struct _GdkDisplayClass
void (*get_maximal_cursor_size) (GdkDisplay *display, void (*get_maximal_cursor_size) (GdkDisplay *display,
guint *width, guint *width,
guint *height); guint *height);
GdkCursor * (*get_cursor_for_type) (GdkDisplay *display,
GdkCursorType type);
GdkCursor * (*get_cursor_for_name) (GdkDisplay *display, GdkCursor * (*get_cursor_for_name) (GdkDisplay *display,
const gchar *name); const gchar *name);
GdkCursor * (*get_cursor_for_surface) (GdkDisplay *display, GdkCursor * (*get_cursor_for_surface) (GdkDisplay *display,

View File

@ -272,7 +272,6 @@ gdk_quartz_display_class_init (GdkQuartzDisplayClass *class)
display_class->store_clipboard = gdk_quartz_display_store_clipboard; display_class->store_clipboard = gdk_quartz_display_store_clipboard;
display_class->supports_shapes = gdk_quartz_display_supports_shapes; display_class->supports_shapes = gdk_quartz_display_supports_shapes;
display_class->supports_input_shapes = gdk_quartz_display_supports_input_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_name = _gdk_quartz_display_get_cursor_for_name;
display_class->get_cursor_for_surface = _gdk_quartz_display_get_cursor_for_surface; 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; display_class->get_default_cursor_size = _gdk_quartz_display_get_default_cursor_size;

View File

@ -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_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_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_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_name = _gdk_wayland_display_get_cursor_for_name;
display_class->get_cursor_for_surface = _gdk_wayland_display_get_cursor_for_surface; display_class->get_cursor_for_surface = _gdk_wayland_display_get_cursor_for_surface;
display_class->supports_cursor_alpha = _gdk_wayland_display_supports_cursor_alpha; display_class->supports_cursor_alpha = _gdk_wayland_display_supports_cursor_alpha;

View File

@ -1263,7 +1263,6 @@ gdk_win32_display_class_init (GdkWin32DisplayClass *klass)
display_class->supports_input_shapes = gdk_win32_display_supports_input_shapes; 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_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_name = _gdk_win32_display_get_cursor_for_name;
display_class->get_cursor_for_surface = _gdk_win32_display_get_cursor_for_surface; 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; display_class->get_default_cursor_size = _gdk_win32_display_get_default_cursor_size;

View File

@ -237,52 +237,6 @@ get_blank_cursor (GdkDisplay *display)
return cursor; 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: * gdk_x11_cursor_get_xdisplay:
* @cursor: (type GdkX11Cursor): a #GdkCursor. * @cursor: (type GdkX11Cursor): a #GdkCursor.
@ -672,11 +626,12 @@ _gdk_x11_display_get_cursor_for_name (GdkDisplay *display,
{ {
xcursor = None; xcursor = None;
} }
else if (strcmp (name, "none") == 0)
{
xcursor = get_blank_cursor (display);
}
else 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); private = find_in_cache (display, GDK_CURSOR_IS_PIXMAP, name);
if (private) if (private)

View File

@ -3158,7 +3158,6 @@ gdk_x11_display_class_init (GdkX11DisplayClass * class)
display_class->supports_shapes = gdk_x11_display_supports_shapes; display_class->supports_shapes = gdk_x11_display_supports_shapes;
display_class->supports_input_shapes = gdk_x11_display_supports_input_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_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_name = _gdk_x11_display_get_cursor_for_name;
display_class->get_cursor_for_surface = _gdk_x11_display_get_cursor_for_surface; 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; display_class->get_default_cursor_size = _gdk_x11_display_get_default_cursor_size;

View File

@ -230,8 +230,6 @@ GdkAtom _gdk_x11_display_manager_atom_intern (GdkDisplayManager *manager,
gchar * _gdk_x11_display_manager_get_atom_name (GdkDisplayManager *manager, gchar * _gdk_x11_display_manager_get_atom_name (GdkDisplayManager *manager,
GdkAtom atom); GdkAtom atom);
GdkCursor *_gdk_x11_display_get_cursor_for_type (GdkDisplay *display,
GdkCursorType type);
GdkCursor *_gdk_x11_display_get_cursor_for_name (GdkDisplay *display, GdkCursor *_gdk_x11_display_get_cursor_for_name (GdkDisplay *display,
const gchar *name); const gchar *name);
GdkCursor *_gdk_x11_display_get_cursor_for_surface (GdkDisplay *display, GdkCursor *_gdk_x11_display_get_cursor_for_surface (GdkDisplay *display,