mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-27 22:20:24 +00:00
gdk: Remove GdkWindow.set_device_cursor() vfunc
That one calls through to GdkDevice.set_window_cursor(), so let's just use that one.
This commit is contained in:
parent
d380cf114b
commit
9c98adcd15
@ -157,8 +157,6 @@ static void
|
||||
gdk_window_impl_broadway_init (GdkWindowImplBroadway *impl)
|
||||
{
|
||||
impl->toplevel_window_type = -1;
|
||||
impl->device_cursor = g_hash_table_new_full (NULL, NULL, NULL,
|
||||
(GDestroyNotify) g_object_unref);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -183,8 +181,6 @@ gdk_window_impl_broadway_finalize (GObject *object)
|
||||
if (impl->cursor)
|
||||
g_object_unref (impl->cursor);
|
||||
|
||||
g_hash_table_destroy (impl->device_cursor);
|
||||
|
||||
broadway_display->toplevels = g_list_remove (broadway_display->toplevels, impl);
|
||||
|
||||
G_OBJECT_CLASS (gdk_window_impl_broadway_parent_class)->finalize (object);
|
||||
@ -613,31 +609,6 @@ gdk_broadway_window_set_transient_for (GdkWindow *window,
|
||||
_gdk_broadway_server_window_set_transient_for (display->server, impl->id, impl->transient_for);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_broadway_set_device_cursor (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
GdkCursor *cursor)
|
||||
{
|
||||
GdkWindowImplBroadway *impl;
|
||||
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
g_return_if_fail (GDK_IS_DEVICE (device));
|
||||
|
||||
impl = GDK_WINDOW_IMPL_BROADWAY (window->impl);
|
||||
|
||||
if (!cursor)
|
||||
g_hash_table_remove (impl->device_cursor, device);
|
||||
else
|
||||
{
|
||||
_gdk_broadway_cursor_update_theme (cursor);
|
||||
g_hash_table_replace (impl->device_cursor,
|
||||
device, g_object_ref (cursor));
|
||||
}
|
||||
|
||||
if (!GDK_WINDOW_DESTROYED (window))
|
||||
GDK_DEVICE_GET_CLASS (device)->set_window_cursor (device, window, cursor);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_broadway_get_geometry (GdkWindow *window,
|
||||
gint *x,
|
||||
@ -1477,7 +1448,6 @@ gdk_window_impl_broadway_class_init (GdkWindowImplBroadwayClass *klass)
|
||||
impl_class->lower = gdk_window_broadway_lower;
|
||||
impl_class->restack_toplevel = gdk_window_broadway_restack_toplevel;
|
||||
impl_class->move_resize = gdk_window_broadway_move_resize;
|
||||
impl_class->set_device_cursor = gdk_window_broadway_set_device_cursor;
|
||||
impl_class->get_geometry = gdk_window_broadway_get_geometry;
|
||||
impl_class->get_root_coords = gdk_window_broadway_get_root_coords;
|
||||
impl_class->get_device_state = gdk_window_broadway_get_device_state;
|
||||
|
@ -53,7 +53,6 @@ struct _GdkWindowImplBroadway
|
||||
cairo_surface_t *ref_surface;
|
||||
|
||||
GdkCursor *cursor;
|
||||
GHashTable *device_cursor;
|
||||
|
||||
int id;
|
||||
|
||||
|
@ -4252,7 +4252,7 @@ gdk_window_set_cursor_internal (GdkWindow *window,
|
||||
|
||||
if (window->window_type == GDK_WINDOW_ROOT ||
|
||||
window->window_type == GDK_WINDOW_FOREIGN)
|
||||
GDK_WINDOW_IMPL_GET_CLASS (window->impl)->set_device_cursor (window, device, cursor);
|
||||
GDK_DEVICE_GET_CLASS (device)->set_window_cursor (device, window, cursor);
|
||||
else
|
||||
{
|
||||
GdkPointerWindowInfo *pointer_info;
|
||||
@ -5136,7 +5136,6 @@ update_cursor (GdkDisplay *display,
|
||||
{
|
||||
GdkWindow *cursor_window, *parent, *toplevel;
|
||||
GdkWindow *pointer_window;
|
||||
GdkWindowImplClass *impl_class;
|
||||
GdkPointerWindowInfo *pointer_info;
|
||||
GdkDeviceGrabInfo *grab;
|
||||
GdkCursor *cursor;
|
||||
@ -5177,8 +5176,7 @@ update_cursor (GdkDisplay *display,
|
||||
/* Set all cursors on toplevel, otherwise its tricky to keep track of
|
||||
* which native window has what cursor set. */
|
||||
toplevel = get_event_toplevel (pointer_window);
|
||||
impl_class = GDK_WINDOW_IMPL_GET_CLASS (toplevel->impl);
|
||||
impl_class->set_device_cursor (toplevel, device, cursor);
|
||||
GDK_DEVICE_GET_CLASS (device)->set_window_cursor (device, toplevel, cursor);
|
||||
}
|
||||
|
||||
static gboolean
|
||||
|
@ -85,10 +85,6 @@ struct _GdkWindowImplClass
|
||||
void (* set_events) (GdkWindow *window,
|
||||
GdkEventMask event_mask);
|
||||
|
||||
void (* set_device_cursor) (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
GdkCursor *cursor);
|
||||
|
||||
void (* get_geometry) (GdkWindow *window,
|
||||
gint *x,
|
||||
gint *y,
|
||||
|
@ -1267,27 +1267,6 @@ gdk_mir_window_impl_set_events (GdkWindow *window,
|
||||
/* We send all events and let GDK decide */
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_set_device_cursor (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
GdkCursor *cursor)
|
||||
{
|
||||
GdkMirWindowImpl *impl = GDK_MIR_WINDOW_IMPL (window->impl);
|
||||
MirConnection *connection = gdk_mir_display_get_mir_connection (impl->display);
|
||||
MirWindowSpec *spec;
|
||||
const gchar *cursor_name;
|
||||
|
||||
if (cursor)
|
||||
cursor_name = _gdk_mir_cursor_get_name (cursor);
|
||||
else
|
||||
cursor_name = mir_default_cursor_name;
|
||||
|
||||
spec = mir_create_window_spec (connection);
|
||||
mir_window_spec_set_cursor_name (spec, cursor_name);
|
||||
mir_window_apply_spec (impl->mir_window, spec);
|
||||
mir_window_spec_release (spec);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_mir_window_impl_get_geometry (GdkWindow *window,
|
||||
gint *x,
|
||||
@ -2246,7 +2225,6 @@ gdk_mir_window_impl_class_init (GdkMirWindowImplClass *klass)
|
||||
impl_class->move_to_rect = gdk_mir_window_impl_move_to_rect;
|
||||
impl_class->get_events = gdk_mir_window_impl_get_events;
|
||||
impl_class->set_events = gdk_mir_window_impl_set_events;
|
||||
impl_class->set_device_cursor = gdk_mir_window_impl_set_device_cursor;
|
||||
impl_class->get_geometry = gdk_mir_window_impl_get_geometry;
|
||||
impl_class->get_root_coords = gdk_mir_window_impl_get_root_coords;
|
||||
impl_class->get_device_state = gdk_mir_window_impl_get_device_state;
|
||||
|
@ -1411,21 +1411,6 @@ gdk_window_quartz_restack_toplevel (GdkWindow *window,
|
||||
[impl->toplevel orderWindow:NSWindowBelow relativeTo:sibling_num];
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_quartz_set_device_cursor (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
GdkCursor *cursor)
|
||||
{
|
||||
NSCursor *nscursor;
|
||||
|
||||
if (GDK_WINDOW_DESTROYED (window))
|
||||
return;
|
||||
|
||||
nscursor = _gdk_quartz_cursor_get_ns_cursor (cursor);
|
||||
|
||||
[nscursor set];
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_quartz_get_geometry (GdkWindow *window,
|
||||
gint *x,
|
||||
@ -2780,7 +2765,6 @@ gdk_window_impl_quartz_class_init (GdkWindowImplQuartzClass *klass)
|
||||
impl_class->lower = gdk_window_quartz_lower;
|
||||
impl_class->restack_toplevel = gdk_window_quartz_restack_toplevel;
|
||||
impl_class->move_resize = gdk_window_quartz_move_resize;
|
||||
impl_class->set_device_cursor = gdk_window_quartz_set_device_cursor;
|
||||
impl_class->get_geometry = gdk_window_quartz_get_geometry;
|
||||
impl_class->get_root_coords = gdk_window_quartz_get_root_coords;
|
||||
impl_class->get_device_state = gdk_window_quartz_get_device_state;
|
||||
|
@ -2708,18 +2708,6 @@ gdk_window_wayland_move_to_rect (GdkWindow *window,
|
||||
impl->position_method = POSITION_METHOD_MOVE_TO_RECT;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_wayland_set_device_cursor (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
GdkCursor *cursor)
|
||||
{
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
g_return_if_fail (GDK_IS_DEVICE (device));
|
||||
|
||||
if (!GDK_WINDOW_DESTROYED (window))
|
||||
GDK_DEVICE_GET_CLASS (device)->set_window_cursor (device, window, cursor);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_wayland_get_geometry (GdkWindow *window,
|
||||
gint *x,
|
||||
@ -3683,7 +3671,6 @@ _gdk_window_impl_wayland_class_init (GdkWindowImplWaylandClass *klass)
|
||||
impl_class->restack_toplevel = gdk_window_wayland_restack_toplevel;
|
||||
impl_class->move_resize = gdk_window_wayland_move_resize;
|
||||
impl_class->move_to_rect = gdk_window_wayland_move_to_rect;
|
||||
impl_class->set_device_cursor = gdk_window_wayland_set_device_cursor;
|
||||
impl_class->get_geometry = gdk_window_wayland_get_geometry;
|
||||
impl_class->get_root_coords = gdk_window_wayland_get_root_coords;
|
||||
impl_class->get_device_state = gdk_window_wayland_get_device_state;
|
||||
|
@ -192,7 +192,6 @@ gdk_window_impl_win32_init (GdkWindowImplWin32 *impl)
|
||||
GdkDisplay *display = gdk_display_get_default ();
|
||||
|
||||
impl->toplevel_window_type = -1;
|
||||
impl->cursor = NULL;
|
||||
impl->hicon_big = NULL;
|
||||
impl->hicon_small = NULL;
|
||||
impl->hint_flags = 0;
|
||||
@ -202,14 +201,6 @@ gdk_window_impl_win32_init (GdkWindowImplWin32 *impl)
|
||||
impl->num_transients = 0;
|
||||
impl->changing_state = FALSE;
|
||||
impl->window_scale = 1;
|
||||
|
||||
if (display != NULL)
|
||||
/* Replace WM-defined default cursor with the default cursor
|
||||
* from our theme. Otherwise newly-opened windows (such as popup
|
||||
* menus of all kinds) will have WM-default cursor when they are
|
||||
* first shown, which will be replaced by our cursor only later on.
|
||||
*/
|
||||
impl->cursor = _gdk_win32_display_get_cursor_for_type (display, GDK_LEFT_PTR);
|
||||
}
|
||||
|
||||
static void
|
||||
@ -229,8 +220,6 @@ gdk_window_impl_win32_finalize (GObject *object)
|
||||
gdk_win32_handle_table_remove (window_impl->handle);
|
||||
}
|
||||
|
||||
g_clear_object (&window_impl->cursor);
|
||||
|
||||
g_clear_pointer (&window_impl->snap_stash, g_free);
|
||||
g_clear_pointer (&window_impl->snap_stash_int, g_free);
|
||||
|
||||
@ -2003,46 +1992,6 @@ _gdk_modal_current (void)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_window_set_device_cursor (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
GdkCursor *cursor)
|
||||
{
|
||||
GdkWindowImplWin32 *impl;
|
||||
GdkCursor *previous_cursor;
|
||||
|
||||
impl = GDK_WINDOW_IMPL_WIN32 (window->impl);
|
||||
|
||||
if (GDK_WINDOW_DESTROYED (window))
|
||||
return;
|
||||
|
||||
GDK_NOTE (MISC, g_print ("gdk_win32_window_set_cursor: %p: %p\n",
|
||||
GDK_WINDOW_HWND (window),
|
||||
cursor));
|
||||
|
||||
/* First get the old cursor, if any (we wait to free the old one
|
||||
* since it may be the current cursor set in the Win32 API right
|
||||
* now).
|
||||
*/
|
||||
previous_cursor = impl->cursor;
|
||||
|
||||
if (cursor)
|
||||
impl->cursor = g_object_ref (cursor);
|
||||
else
|
||||
/* Use default cursor otherwise. Don't just set NULL cursor,
|
||||
* because that will just hide the cursor, which is not
|
||||
* what the caller probably wanted.
|
||||
*/
|
||||
impl->cursor = _gdk_win32_display_get_cursor_for_type (gdk_device_get_display (device),
|
||||
GDK_LEFT_PTR);
|
||||
|
||||
GDK_DEVICE_GET_CLASS (device)->set_window_cursor (device, window, impl->cursor);
|
||||
|
||||
/* Destroy the previous cursor */
|
||||
if (previous_cursor != NULL)
|
||||
g_object_unref (previous_cursor);
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_win32_window_get_geometry (GdkWindow *window,
|
||||
gint *x,
|
||||
|
@ -232,7 +232,6 @@ struct _GdkWindowImplWin32
|
||||
|
||||
gint8 toplevel_window_type;
|
||||
|
||||
GdkCursor *cursor;
|
||||
HICON hicon_big;
|
||||
HICON hicon_small;
|
||||
|
||||
|
@ -152,8 +152,6 @@ G_DEFINE_TYPE (GdkWindowImplX11, gdk_window_impl_x11, GDK_TYPE_WINDOW_IMPL)
|
||||
static void
|
||||
gdk_window_impl_x11_init (GdkWindowImplX11 *impl)
|
||||
{
|
||||
impl->device_cursor = g_hash_table_new_full (NULL, NULL,
|
||||
NULL, g_object_unref);
|
||||
impl->window_scale = 1;
|
||||
impl->frame_sync_enabled = TRUE;
|
||||
}
|
||||
@ -535,8 +533,6 @@ gdk_window_impl_x11_finalize (GObject *object)
|
||||
if (impl->cursor)
|
||||
g_object_unref (impl->cursor);
|
||||
|
||||
g_hash_table_destroy (impl->device_cursor);
|
||||
|
||||
G_OBJECT_CLASS (gdk_window_impl_x11_parent_class)->finalize (object);
|
||||
}
|
||||
|
||||
@ -2518,31 +2514,6 @@ gdk_x11_window_set_transient_for (GdkWindow *window,
|
||||
GDK_WINDOW_XID (parent));
|
||||
}
|
||||
|
||||
static void
|
||||
gdk_window_x11_set_device_cursor (GdkWindow *window,
|
||||
GdkDevice *device,
|
||||
GdkCursor *cursor)
|
||||
{
|
||||
GdkWindowImplX11 *impl;
|
||||
|
||||
g_return_if_fail (GDK_IS_WINDOW (window));
|
||||
g_return_if_fail (GDK_IS_DEVICE (device));
|
||||
|
||||
impl = GDK_WINDOW_IMPL_X11 (window->impl);
|
||||
|
||||
if (!cursor)
|
||||
g_hash_table_remove (impl->device_cursor, device);
|
||||
else
|
||||
{
|
||||
_gdk_x11_cursor_update_theme (cursor);
|
||||
g_hash_table_replace (impl->device_cursor,
|
||||
device, g_object_ref (cursor));
|
||||
}
|
||||
|
||||
if (!GDK_WINDOW_DESTROYED (window))
|
||||
GDK_DEVICE_GET_CLASS (device)->set_window_cursor (device, window, cursor);
|
||||
}
|
||||
|
||||
GdkCursor *
|
||||
_gdk_x11_window_get_cursor (GdkWindow *window)
|
||||
{
|
||||
@ -5032,7 +5003,6 @@ gdk_window_impl_x11_class_init (GdkWindowImplX11Class *klass)
|
||||
impl_class->lower = gdk_window_x11_lower;
|
||||
impl_class->restack_toplevel = gdk_window_x11_restack_toplevel;
|
||||
impl_class->move_resize = gdk_window_x11_move_resize;
|
||||
impl_class->set_device_cursor = gdk_window_x11_set_device_cursor;
|
||||
impl_class->get_geometry = gdk_window_x11_get_geometry;
|
||||
impl_class->get_root_coords = gdk_window_x11_get_root_coords;
|
||||
impl_class->get_device_state = gdk_window_x11_get_device_state;
|
||||
|
@ -66,7 +66,6 @@ struct _GdkWindowImplX11
|
||||
|
||||
GdkToplevelX11 *toplevel; /* Toplevel-specific information */
|
||||
GdkCursor *cursor;
|
||||
GHashTable *device_cursor;
|
||||
|
||||
guint no_bg : 1; /* Set when the window background is temporarily
|
||||
* unset during resizing and scaling */
|
||||
|
Loading…
Reference in New Issue
Block a user