[gtk+] wayland: Keep hotspot when changing cursors
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] wayland: Keep hotspot when changing cursors
- Date: Thu, 21 Mar 2013 02:20:57 +0000 (UTC)
commit 26d3fc311b98c9baf2131609ff724d3e196c77f4
Author: Matthias Clasen <mclasen redhat com>
Date: Wed Mar 20 21:47:12 2013 -0400
wayland: Keep hotspot when changing cursors
We need to pass the delta between the old and new hotspot
when attaching the new cursor surface, to keep the hotspot
at the same position. We can't deal with this in the compositor,
since the set_cursor call already overwrites the old hotspot,
so the information is lost by the time the attach happens.
Unfortunately, we can't query the initial hotspot from
the compositor, so the first cursor change will make the
hotspot jump.
https://bugzilla.gnome.org/show_bug.cgi?id=695512
gdk/wayland/gdkdevice-wayland.c | 6 +++++-
1 files changed, 5 insertions(+), 1 deletions(-)
---
diff --git a/gdk/wayland/gdkdevice-wayland.c b/gdk/wayland/gdkdevice-wayland.c
index e7776c8..24176e9 100644
--- a/gdk/wayland/gdkdevice-wayland.c
+++ b/gdk/wayland/gdkdevice-wayland.c
@@ -76,6 +76,7 @@ struct _GdkWaylandDeviceData
GdkWaylandSelectionOffer *selection_offer_out;
struct wl_surface *pointer_surface;
+ int hotspot_x, hotspot_y;
};
struct _GdkWaylandDevice
@@ -172,10 +173,13 @@ gdk_wayland_device_set_window_cursor (GdkDevice *device,
_gdk_wayland_display_get_serial (wayland_display),
wd->pointer_surface,
x, y);
- wl_surface_attach (wd->pointer_surface, buffer, 0, 0);
+ wl_surface_attach (wd->pointer_surface, buffer, wd->hotspot_x - x, wd->hotspot_y - y);
wl_surface_damage (wd->pointer_surface, 0, 0, w, h);
wl_surface_commit(wd->pointer_surface);
+ wd->hotspot_x = x;
+ wd->hotspot_y = y;
+
g_object_unref (cursor);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]