[maemo-commits] [maemo-commits] r13515 - in projects/haf/trunk/gtk+: . gtk

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Aug 31 11:53:01 EEST 2007
Author: xan
Date: 2007-08-31 11:52:59 +0300 (Fri, 31 Aug 2007)
New Revision: 13515

Modified:
   projects/haf/trunk/gtk+/ChangeLog
   projects/haf/trunk/gtk+/gtk/gtkentrycompletion.c
Log:
Use the new positioning/heigth algorithm for entrycompletion always.


Modified: projects/haf/trunk/gtk+/ChangeLog
===================================================================
--- projects/haf/trunk/gtk+/ChangeLog	2007-08-30 18:31:51 UTC (rev 13514)
+++ projects/haf/trunk/gtk+/ChangeLog	2007-08-31 08:52:59 UTC (rev 13515)
@@ -1,3 +1,9 @@
+2007-08-31  Xan Lopez  <xan.lopez at nokia.com>
+
+	* gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup):
+	use the new direction and height algorithm even when there are
+	no INPUT_AREAS, as it limits the height correctly.
+
 2007-08-30  Xan Lopez  <xan.lopez at nokia.com>
 
 	* gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup):

Modified: projects/haf/trunk/gtk+/gtk/gtkentrycompletion.c
===================================================================
--- projects/haf/trunk/gtk+/gtk/gtkentrycompletion.c	2007-08-30 18:31:51 UTC (rev 13514)
+++ projects/haf/trunk/gtk+/gtk/gtkentrycompletion.c	2007-08-31 08:52:59 UTC (rev 13515)
@@ -1415,26 +1415,32 @@
 
   n_rects = nitems_return/4;
 
-  if (ret_val == Success && n_rects > 0)
+  if (ret_val == Success)
     {
       int i, j;
       GdkRectangle widget_rect;
-      GdkRectangle *rectangles = g_slice_alloc (sizeof(GdkRectangle)*n_rects);
+      GdkRectangle *rectangles = NULL;
       gint root_x, root_y;
       GdkRectangle *top = NULL, *bottom = NULL;
       gint to_top = -1, to_bottom = -1;
 
       val = (guint32*)data;
 
-      for (i = 0, j = 0; j < n_rects; i+=4, j++)
+      if (n_rects > 0)
         {
-          rectangles[j].x = val[i];
-          rectangles[j].y = val[i+1];
-          rectangles[j].width = val[i+2];
-          rectangles[j].height = val[i+3];
+          rectangles = g_slice_alloc (sizeof(GdkRectangle)*n_rects);
+
+          for (i = 0, j = 0; j < n_rects; i+=4, j++)
+            {
+              rectangles[j].x = val[i];
+              rectangles[j].y = val[i+1];
+              rectangles[j].width = val[i+2];
+              rectangles[j].height = val[i+3];
+            }
         }
 
-      XFree (data);
+      if (nitems_return > 0)
+        XFree (data);
 
       gdk_window_get_origin (completion->priv->entry->window, &root_x, &root_y);
 
@@ -1461,6 +1467,7 @@
                 }
             }
         }
+
       /* Which one is nearer */
       if (top)
         to_top = root_y - (top->y + top->height);
@@ -1494,7 +1501,8 @@
           y -= popup_req.height;
         }
 
-      g_slice_free1 (sizeof(GdkRectangle)*n_rects, rectangles);
+      if (rectangles)
+        g_slice_free1 (sizeof(GdkRectangle)*n_rects, rectangles);
     }
   else
 #endif /* MAEMO_CHANGES && GDK_WINDOWING_X11 */


More information about the maemo-commits mailing list