[virt-tools-list] [PATCH virt-viewer v2] Avoid use of deprecated GTK3 pointer APIs
Daniel P. Berrange
berrange at redhat.com
Tue May 15 13:56:54 UTC 2012
From: "Daniel P. Berrange" <berrange at redhat.com>
The gtk_widget_get_pointer() API is deprecated in GTK3 since it
is not aware of multiple pointers. Replace its usage in autoDrawer.c
with GdkDeviceManager and friends
Signed-off-by: Daniel P. Berrange <berrange at redhat.com>
---
src/view/autoDrawer.c | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/src/view/autoDrawer.c b/src/view/autoDrawer.c
index b0c5028..7a84e7b 100644
--- a/src/view/autoDrawer.c
+++ b/src/view/autoDrawer.c
@@ -215,11 +215,22 @@ ViewAutoDrawerUpdate(ViewAutoDrawer *that, // IN
/* Is the mouse cursor inside the event box? */
- {
+ if (gtk_widget_get_window(priv->evBox)) {
int x;
int y;
+#if GTK_CHECK_VERSION(3, 0, 0)
+ GdkDevice *dev;
+ GdkDeviceManager *devmgr;
+
+ devmgr = gdk_display_get_device_manager(gtk_widget_get_display(priv->evBox));
+ dev = gdk_device_manager_get_client_pointer(devmgr);
+ gdk_window_get_device_position(gtk_widget_get_window(priv->evBox),
+ dev, &x, &y, NULL);
+#else
gtk_widget_get_pointer(priv->evBox, &x, &y);
+#endif
+
gtk_widget_get_allocation(priv->evBox, &allocation);
g_assert(gtk_container_get_border_width( GTK_CONTAINER(priv->evBox))
== 0);
--
1.7.10.1
More information about the virt-tools-list
mailing list