[virt-tools-list] [PATCH virt-viewer] Remove use of deprecated GTK pointer APIs

Daniel P. Berrange berrange at redhat.com
Tue May 15 13:06:58 UTC 2012


From: "Daniel P. Berrange" <berrange at redhat.com>

The gtk_widget_get_pointer() API is deprecated since it is not
aware of multiple pointers. Replace its usage in autoDrawer.c
with GdkDeviceManager and friends
---
 src/view/autoDrawer.c |   11 +++++++++--
 1 file changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/view/autoDrawer.c b/src/view/autoDrawer.c
index b0c5028..bb35140 100644
--- a/src/view/autoDrawer.c
+++ b/src/view/autoDrawer.c
@@ -215,11 +215,18 @@ ViewAutoDrawerUpdate(ViewAutoDrawer *that, // IN
 
    /* Is the mouse cursor inside the event box? */
 
-   {
+   if (gtk_widget_get_window(priv->evBox)) {
       int x;
       int y;
+      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);
 
-      gtk_widget_get_pointer(priv->evBox, &x, &y);
       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