[maemo-commits] [maemo-commits] r14739 - projects/haf/trunk/gtk+/gtk

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Nov 8 13:37:54 EET 2007
Author: xan
Date: 2007-11-08 13:37:50 +0200 (Thu, 08 Nov 2007)
New Revision: 14739

Modified:
   projects/haf/trunk/gtk+/gtk/gtkwidget.c
Log:
Set the TAH cursor in the root window.

HildonDesktop covers the applets in home with a GdkWindow used to
filter events and ease drag-and-drop, reordering, etc of those applets.
When an event passes the filtering a complex hack is used to set as the
event window the window that should have received the event if the covering
window were not there. GTK TAH will use that window to set the cursor
animation, but as the window is always covered it will never have the chance
to actually show the cursor.

This patch sets the cursor in the root window. As every window defaults to its
parent's cursor, it should make the TAH animation always visible.


Modified: projects/haf/trunk/gtk+/gtk/gtkwidget.c
===================================================================
--- projects/haf/trunk/gtk+/gtk/gtkwidget.c	2007-11-08 11:26:09 UTC (rev 14738)
+++ projects/haf/trunk/gtk+/gtk/gtkwidget.c	2007-11-08 11:37:50 UTC (rev 14739)
@@ -9084,7 +9084,7 @@
     td->timer_id = 0;
 
   gdk_display_get_pointer (gdk_drawable_get_display (td->tah_on_window),
-			   NULL, &x, &y, NULL);
+                           NULL, &x, &y, NULL);
 
   /* Did we dragged too far from the start point */
   if (gtk_drag_check_threshold (widget, td->x, td->y, x, y))
@@ -9139,12 +9139,26 @@
 
   if (!gtk_widget_tap_and_hold_query (widget, event) && !td->timer_id)
     {
+      GdkWindow *root_window;
       gdk_display_get_pointer (gtk_widget_get_display (widget),
 			       NULL, &td->x, &td->y, NULL);
 
       td->timer_counter = TAP_AND_HOLD_TIMER_COUNTER;
-      td->tah_on_window = ((GdkEventButton *)event)->window;
-
+      /* We set the cursor in the root window for the TAH animation to be
+         visible in every possible case, like windows completely covering
+         some widget to filter events.
+      */
+      root_window = gtk_widget_get_root_window (widget);
+      if (root_window == NULL)
+        {
+          /* We are getting events from a widget that's not in a
+             hierarchy, it might happen (like putting a dummy widget
+             as user_data in a GdkWindow). Try really hard to get
+             the root window
+          */
+          root_window = gdk_screen_get_root_window (gdk_screen_get_default ());
+        }
+      td->tah_on_window = root_window;
       tap_and_hold_init_animation (td);
       td->timer_id = g_timeout_add (td->interval,
 				    (GSourceFunc)


More information about the maemo-commits mailing list