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
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);
_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,
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;
cairo_surface_t *ref_surface;
GdkCursor *cursor;
- GHashTable *device_cursor;
int id;
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;
{
GdkWindow *cursor_window, *parent, *toplevel;
GdkWindow *pointer_window;
- GdkWindowImplClass *impl_class;
GdkPointerWindowInfo *pointer_info;
GdkDeviceGrabInfo *grab;
GdkCursor *cursor;
/* 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
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,
/* 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,
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;
[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,
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;
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,
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;
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;
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
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);
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,
gint8 toplevel_window_type;
- GdkCursor *cursor;
HICON hicon_big;
HICON hicon_small;
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;
}
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);
}
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)
{
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;
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 */