[maemo-commits] [maemo-commits] r8362 - in projects/haf/trunk/gtk+: . gdk/x11

From: www-data at stage.maemo.org www-data at stage.maemo.org
Date: Mon Nov 27 17:43:42 EET 2006
Author: tko
Date: 2006-11-27 17:43:40 +0200 (Mon, 27 Nov 2006)
New Revision: 8362

Modified:
   projects/haf/trunk/gtk+/ChangeLog
   projects/haf/trunk/gtk+/gdk/x11/gdkinput.c
Log:
Fix a leak and make it work even if called after ConfigureNotify

2006-11-27  Tommi Komulainen  <tommi.komulainen at nokia.com>

	* gdk/x11/gdkinput.c (gdk_input_set_extension_events): Stop leaking
	memory when called multiple times to enable extension events. Get the
	root relative geometry in case we're called after ConfigureNotify.


Modified: projects/haf/trunk/gtk+/ChangeLog
===================================================================
--- projects/haf/trunk/gtk+/ChangeLog	2006-11-27 15:36:01 UTC (rev 8361)
+++ projects/haf/trunk/gtk+/ChangeLog	2006-11-27 15:43:40 UTC (rev 8362)
@@ -1,5 +1,11 @@
 2006-11-27  Tommi Komulainen  <tommi.komulainen at nokia.com>
 
+	* gdk/x11/gdkinput.c (gdk_input_set_extension_events): Stop leaking
+	memory when called multiple times to enable extension events. Get the
+	root relative geometry in case we're called after ConfigureNotify.
+
+2006-11-27  Tommi Komulainen  <tommi.komulainen at nokia.com>
+
 	* gdk/x11/gdkinput-xfree.c (_gdk_input_other_event,
 	_gdk_input_configure_event, _gdk_input_enter_event): Check the right
 	variable with g_return_if_fail.

Modified: projects/haf/trunk/gtk+/gdk/x11/gdkinput.c
===================================================================
--- projects/haf/trunk/gtk+/gdk/x11/gdkinput.c	2006-11-27 15:36:01 UTC (rev 8361)
+++ projects/haf/trunk/gtk+/gdk/x11/gdkinput.c	2006-11-27 15:43:40 UTC (rev 8362)
@@ -287,12 +287,6 @@
   return NULL;      /* Not found */
 }
 
-/* FIXME: this routine currently needs to be called between creation
-   and the corresponding configure event (because it doesn't get the
-   root_relative_geometry).  This should work with
-   gtk_window_set_extension_events, but will likely fail in other
-   cases */
-
 void
 gdk_input_set_extension_events (GdkWindow *window, gint mask,
 				GdkExtensionMode mode)
@@ -315,23 +309,35 @@
 
   if (mask != 0)
     {
-      iw = g_new(GdkInputWindow,1);
+      iw = _gdk_input_window_find (window);
+      if (!iw)
+	{
+	  iw = g_new(GdkInputWindow,1);
 
-      iw->window = window;
-      iw->mode = mode;
+	  iw->window = window;
+	  iw->mode = mode;
 
-      iw->obscuring = NULL;
-      iw->num_obscuring = 0;
-      iw->grabbed = FALSE;
+	  iw->obscuring = NULL;
+	  iw->num_obscuring = 0;
+	  iw->grabbed = FALSE;
 
-      display_x11->input_windows = g_list_append(display_x11->input_windows,iw);
+	  display_x11->input_windows = g_list_append(display_x11->input_windows,iw);
+	}
       window_private->extension_events = mask;
 
+#ifdef XINPUT_XFREE
       /* Add enter window events to the event mask */
-      /* FIXME, this is not needed for XINPUT_NONE */
+      /* this is not needed for XINPUT_NONE */
       gdk_window_set_events (window,
 			     gdk_window_get_events (window) | 
 			     GDK_ENTER_NOTIFY_MASK);
+
+      /* we might not receive ConfigureNotify so get the root_relative_geometry
+       * now, just in case */
+      _gdk_input_get_root_relative_geometry (GDK_WINDOW_XDISPLAY (window),
+					     GDK_WINDOW_XWINDOW (window),
+					     &iw->root_x, &iw->root_y, NULL, NULL);
+#endif
     }
   else
     {


More information about the maemo-commits mailing list