gdk: Cursors are created generically

There are no longer subclasses for cursors now.
This commit is contained in:
Benjamin Otte
2017-11-03 22:49:04 +01:00
parent ec824b9e50
commit 4e7a056777
16 changed files with 10 additions and 153 deletions

View File

@@ -48,30 +48,6 @@ _gdk_broadway_cursor_update_theme (GdkCursor *cursor)
g_return_if_fail (cursor != NULL);
}
GdkCursor *
_gdk_broadway_display_get_cursor_for_texture (GdkDisplay *display,
GdkTexture *texture,
int x,
int y)
{
return g_object_new (GDK_TYPE_CURSOR,
"display", display,
"texture", texture,
"x", x,
"y", y,
NULL);
}
GdkCursor*
_gdk_broadway_display_get_cursor_for_name (GdkDisplay *display,
const gchar *name)
{
return g_object_new (GDK_TYPE_CURSOR,
"display", display,
"name", name,
NULL);
}
gboolean
_gdk_broadway_display_supports_cursor_alpha (GdkDisplay *display)
{

View File

@@ -358,8 +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_name = _gdk_broadway_display_get_cursor_for_name;
display_class->get_cursor_for_texture = _gdk_broadway_display_get_cursor_for_texture;
display_class->get_default_cursor_size = _gdk_broadway_display_get_default_cursor_size;
display_class->get_maximal_cursor_size = _gdk_broadway_display_get_maximal_cursor_size;
display_class->supports_cursor_alpha = _gdk_broadway_display_supports_cursor_alpha;

View File

@@ -340,7 +340,10 @@ gdk_cursor_new_from_name (GdkDisplay *display,
g_return_val_if_fail (GDK_IS_DISPLAY (display), NULL);
g_return_val_if_fail (name != NULL, NULL);
return GDK_DISPLAY_GET_CLASS (display)->get_cursor_for_name (display, name);
return g_object_new (GDK_TYPE_CURSOR,
"display", display,
"name", name,
NULL);
}
/**
@@ -455,9 +458,12 @@ gdk_cursor_new_from_texture (GdkDisplay *display,
g_return_val_if_fail (0 <= hotspot_x && hotspot_x < gdk_texture_get_width (texture), NULL);
g_return_val_if_fail (0 <= hotspot_y && hotspot_y < gdk_texture_get_height (texture), NULL);
return GDK_DISPLAY_GET_CLASS (display)->get_cursor_for_texture (display,
texture,
hotspot_x, hotspot_y);
return g_object_new (GDK_TYPE_CURSOR,
"display", display,
"texture", texture,
"hotspot-x", hotspot_x,
"hotspot-y", hotspot_y,
NULL);
}
/**

View File

@@ -145,12 +145,6 @@ struct _GdkDisplayClass
void (*get_maximal_cursor_size) (GdkDisplay *display,
guint *width,
guint *height);
GdkCursor * (*get_cursor_for_name) (GdkDisplay *display,
const gchar *name);
GdkCursor * (*get_cursor_for_texture) (GdkDisplay *display,
GdkTexture *texture,
int x,
int y);
GdkAppLaunchContext * (*get_app_launch_context) (GdkDisplay *display);

View File

@@ -77,10 +77,6 @@ GdkDevice *_gdk_mir_pointer_new (GdkDeviceManager *device_manager, const gchar *
void _gdk_mir_pointer_set_location (GdkDevice *pointer, gdouble x, gdouble y, GdkWindow *window, GdkModifierType mask);
GdkCursor *_gdk_mir_cursor_new_for_type (GdkDisplay *display, GdkCursorType type);
GdkCursor *_gdk_mir_cursor_new_for_name (GdkDisplay *display, const gchar *name);
const gchar *_gdk_mir_cursor_get_name (GdkCursor *cursor);
MirWindow *_gdk_mir_window_get_mir_window (GdkWindow *window);

View File

@@ -429,29 +429,6 @@ gdk_mir_display_get_maximal_cursor_size (GdkDisplay *display,
*width = *height = 32; // FIXME: Random value
}
static GdkCursor *
gdk_mir_display_get_cursor_for_type (GdkDisplay *display,
GdkCursorType cursor_type)
{
return _gdk_mir_cursor_new_for_type (display, cursor_type);
}
static GdkCursor *
gdk_mir_display_get_cursor_for_name (GdkDisplay *display,
const gchar *name)
{
return _gdk_mir_cursor_new_for_name (display, name);
}
static GdkCursor *
gdk_mir_display_get_cursor_for_surface (GdkDisplay *display,
cairo_surface_t *surface,
gdouble x,
gdouble y)
{
return NULL;
}
static GdkAppLaunchContext *
gdk_mir_display_get_app_launch_context (GdkDisplay *display)
{
@@ -1222,9 +1199,6 @@ gdk_mir_display_class_init (GdkMirDisplayClass *klass)
display_class->store_clipboard = gdk_mir_display_store_clipboard;
display_class->get_default_cursor_size = gdk_mir_display_get_default_cursor_size;
display_class->get_maximal_cursor_size = gdk_mir_display_get_maximal_cursor_size;
display_class->get_cursor_for_type = gdk_mir_display_get_cursor_for_type;
display_class->get_cursor_for_name = gdk_mir_display_get_cursor_for_name;
display_class->get_cursor_for_surface = gdk_mir_display_get_cursor_for_surface;
display_class->get_app_launch_context = gdk_mir_display_get_app_launch_context;
display_class->get_next_serial = gdk_mir_display_get_next_serial;
display_class->notify_startup_complete = gdk_mir_display_notify_startup_complete;

View File

@@ -272,8 +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_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;
display_class->get_maximal_cursor_size = _gdk_quartz_display_get_maximal_cursor_size;
display_class->supports_cursor_alpha = _gdk_quartz_display_supports_cursor_alpha;

View File

@@ -51,14 +51,6 @@ void _gdk_quartz_display_event_data_free (GdkDisplay *display,
GdkEvent *event);
/* Display methods - cursor */
GdkCursor *_gdk_quartz_display_get_cursor_for_type (GdkDisplay *display,
GdkCursorType type);
GdkCursor *_gdk_quartz_display_get_cursor_for_name (GdkDisplay *display,
const gchar *name);
GdkCursor *_gdk_quartz_display_get_cursor_for_surface (GdkDisplay *display,
cairo_surface_t *surface,
gdouble x,
gdouble y);
gboolean _gdk_quartz_display_supports_cursor_alpha (GdkDisplay *display);
gboolean _gdk_quartz_display_supports_cursor_color (GdkDisplay *display);
void _gdk_quartz_display_get_default_cursor_size (GdkDisplay *display,

View File

@@ -306,30 +306,6 @@ _gdk_wayland_cursor_get_next_image_index (GdkWaylandDisplay *display,
return current_image_index;
}
GdkCursor *
_gdk_wayland_display_get_cursor_for_name (GdkDisplay *display,
const gchar *name)
{
return g_object_new (GDK_TYPE_CURSOR,
"display", display,
"name", name,
NULL);
}
GdkCursor *
_gdk_wayland_display_get_cursor_for_texture (GdkDisplay *display,
GdkTexture *texture,
int x,
int y)
{
return g_object_new (GDK_TYPE_CURSOR,
"display", display,
"texture", texture,
"x", x,
"y", y,
NULL);
}
void
_gdk_wayland_display_get_default_cursor_size (GdkDisplay *display,
guint *width,

View File

@@ -1036,8 +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_name = _gdk_wayland_display_get_cursor_for_name;
display_class->get_cursor_for_texture = _gdk_wayland_display_get_cursor_for_texture;
display_class->supports_cursor_alpha = _gdk_wayland_display_supports_cursor_alpha;
display_class->supports_cursor_color = _gdk_wayland_display_supports_cursor_color;
display_class->get_next_serial = gdk_wayland_display_get_next_serial;

View File

@@ -62,15 +62,6 @@ void _gdk_wayland_display_finalize_cursors (GdkWaylandDisplay *display);
struct wl_cursor_theme * _gdk_wayland_display_get_scaled_cursor_theme (GdkWaylandDisplay *display_wayland,
guint scale);
GdkCursor *_gdk_wayland_display_get_cursor_for_name_with_scale (GdkDisplay *display,
const char *name,
guint scale);
GdkCursor *_gdk_wayland_display_get_cursor_for_name (GdkDisplay *display,
const gchar *name);
GdkCursor *_gdk_wayland_display_get_cursor_for_texture (GdkDisplay *display,
GdkTexture *texture,
int x,
int y);
void _gdk_wayland_display_get_default_cursor_size (GdkDisplay *display,
guint *width,
guint *height);

View File

@@ -1258,8 +1258,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_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;
display_class->get_maximal_cursor_size = _gdk_win32_display_get_maximal_cursor_size;
display_class->supports_cursor_alpha = _gdk_win32_display_supports_cursor_alpha;

View File

@@ -404,14 +404,6 @@ void win32_cursor_theme_destroy (Win32CursorTheme *theme);
Win32CursorTheme *_gdk_win32_display_get_cursor_theme (GdkWin32Display *win32_display);
/* GdkDisplay member functions */
GdkCursor *_gdk_win32_display_get_cursor_for_type (GdkDisplay *display,
GdkCursorType cursor_type);
GdkCursor *_gdk_win32_display_get_cursor_for_name (GdkDisplay *display,
const gchar *name);
GdkCursor *_gdk_win32_display_get_cursor_for_surface (GdkDisplay *display,
cairo_surface_t *surface,
gdouble x,
gdouble y);
void _gdk_win32_display_get_default_cursor_size (GdkDisplay *display,
guint *width,
guint *height);

View File

@@ -143,30 +143,6 @@ static const struct {
{ NULL, NULL, XC_X_cursor }
};
GdkCursor*
_gdk_x11_display_get_cursor_for_name (GdkDisplay *display,
const gchar *name)
{
return g_object_new (GDK_TYPE_CURSOR,
"display", display,
"name", name,
NULL);
}
GdkCursor *
_gdk_x11_display_get_cursor_for_texture (GdkDisplay *display,
GdkTexture *texture,
int x,
int y)
{
return g_object_new (GDK_TYPE_CURSOR,
"display", display,
"texture", texture,
"x", x,
"y", y,
NULL);
}
#ifdef HAVE_XCURSOR
static XcursorImage*

View File

@@ -3190,8 +3190,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_name = _gdk_x11_display_get_cursor_for_name;
display_class->get_cursor_for_texture = _gdk_x11_display_get_cursor_for_texture;
display_class->get_default_cursor_size = _gdk_x11_display_get_default_cursor_size;
display_class->get_maximal_cursor_size = _gdk_x11_display_get_maximal_cursor_size;
display_class->supports_cursor_alpha = _gdk_x11_display_supports_cursor_alpha;

View File

@@ -230,12 +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_name (GdkDisplay *display,
const gchar *name);
GdkCursor *_gdk_x11_display_get_cursor_for_texture (GdkDisplay *display,
GdkTexture *texture,
int x,
int y);
gboolean _gdk_x11_display_supports_cursor_alpha (GdkDisplay *display);
gboolean _gdk_x11_display_supports_cursor_color (GdkDisplay *display);
void _gdk_x11_display_get_default_cursor_size (GdkDisplay *display,