[maemo-commits] [maemo-commits] r14310 - in projects/haf/trunk/hildon-desktop: . libhildondesktop

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Thu Oct 4 10:07:12 EEST 2007
Author: jobi
Date: 2007-10-04 10:07:11 +0300 (Thu, 04 Oct 2007)
New Revision: 14310

Modified:
   projects/haf/trunk/hildon-desktop/ChangeLog
   projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-home-item.c
Log:

2007-10-04  Johan Bilien  <johan.bilien at nokia.com>

	* libhildondesktop/hildon-desktop-home-item.c
	(hildon_desktop_home_item_propagate_button_event): when forwarding
	button-release events, lookup for the child window using the
	previous button-press event coordinates. Fixes: NB#71808



Modified: projects/haf/trunk/hildon-desktop/ChangeLog
===================================================================
--- projects/haf/trunk/hildon-desktop/ChangeLog	2007-10-04 06:49:47 UTC (rev 14309)
+++ projects/haf/trunk/hildon-desktop/ChangeLog	2007-10-04 07:07:11 UTC (rev 14310)
@@ -1,3 +1,10 @@
+2007-10-04  Johan Bilien  <johan.bilien at nokia.com>
+
+	* libhildondesktop/hildon-desktop-home-item.c
+	(hildon_desktop_home_item_propagate_button_event): when forwarding
+	button-release events, lookup for the child window using the
+	previous button-press event coordinates. Fixes: NB#71808
+
 2007-10-03  Johan Bilien  <johan.bilien at nokia.com>
 
 	* src/hd-desktop.c: fixed the leak of a GList

Modified: projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-home-item.c
===================================================================
--- projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-home-item.c	2007-10-04 06:49:47 UTC (rev 14309)
+++ projects/haf/trunk/hildon-desktop/libhildondesktop/hildon-desktop-home-item.c	2007-10-04 07:07:11 UTC (rev 14310)
@@ -121,6 +121,7 @@
   gint          delta_y;
   gboolean      overlaps;
   GtkAllocation old_allocation;
+  gint          last_press_x, last_press_y;
 
 } HildonDesktopHomeItemPriv;
 
@@ -1241,9 +1242,18 @@
   if (!priv->last_click_event)
     return;
 
+  /* When propagating ButtonRelease we still need to look for
+   * the window on which the button was _pressed_ */
+
+  if (press)
+  {
+    priv->last_press_x = priv->last_click_event->x;
+    priv->last_press_y = priv->last_click_event->y;
+  }
+
   child = hildon_desktop_home_item_get_window_at (item,
-                                                  priv->last_click_event->x,
-                                                  priv->last_click_event->y,
+                                                  priv->last_press_x,
+                                                  priv->last_press_y,
                                                   &x, &y);
 
   if (!child)
@@ -1251,10 +1261,11 @@
 
   event = (GdkEventButton *)gdk_event_copy ((GdkEvent *)priv->last_click_event);
 
-  event->x = x;
-  event->y = y;
+  /* When propagating ButtonRelease, add the offset between the
+   * press and release */
+  event->x = x + (priv->last_click_event->x - priv->last_press_x);
+  event->y = y + (priv->last_click_event->y - priv->last_press_y);
 
-
   /* Send synthetic enter event */
   crossing_event = (GdkEventCrossing *) gdk_event_new (GDK_ENTER_NOTIFY);
   ((GdkEventAny *)crossing_event)->send_event = FALSE;


More information about the maemo-commits mailing list