gtk+ r20359 - in trunk: . gtk



Author: mitch
Date: Thu Jun 12 11:17:16 2008
New Revision: 20359
URL: http://svn.gnome.org/viewvc/gtk+?rev=20359&view=rev

Log:
2008-06-12  Michael Natterer  <mitch imendio com>

	* gtk/gtkentrycompletion.c (_gtk_entry_completion_resize_popup):
	limit the number of displayed items by the actual screen height
	instead of some arbitrary value (Bug #408154, Xan Lopez and
	Christian Dywan).



Modified:
   trunk/ChangeLog
   trunk/gtk/gtkentrycompletion.c

Modified: trunk/gtk/gtkentrycompletion.c
==============================================================================
--- trunk/gtk/gtkentrycompletion.c	(original)
+++ trunk/gtk/gtkentrycompletion.c	Thu Jun 12 11:17:16 2008
@@ -1383,8 +1383,6 @@
 
   matches = gtk_tree_model_iter_n_children (GTK_TREE_MODEL (completion->priv->filter_model), NULL);
 
-  items = MIN (matches, 15);
-
   gtk_tree_view_column_cell_get_size (completion->priv->column, NULL,
                                       NULL, NULL, NULL, &height);
 
@@ -1396,16 +1394,23 @@
   
   gtk_widget_realize (completion->priv->tree_view);
 
-  if (items <= 0)
-    gtk_widget_hide (completion->priv->scrolled_window);
-  else
-    gtk_widget_show (completion->priv->scrolled_window);
-
   screen = gtk_widget_get_screen (GTK_WIDGET (completion->priv->entry));
   monitor_num = gdk_screen_get_monitor_at_window (screen, 
 						  GTK_WIDGET (completion->priv->entry)->window);
   gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor);
 
+  
+
+  if (y > monitor.height / 2)
+    items = MIN (matches, (monitor.y + y) / height);
+  else
+    items = MIN (matches, (monitor.height - y) / height - 1);
+
+  if (items <= 0)
+    gtk_widget_hide (completion->priv->scrolled_window);
+  else
+    gtk_widget_show (completion->priv->scrolled_window);
+
   if (completion->priv->popup_set_width)
     width = MIN (completion->priv->entry->allocation.width, monitor.width) - 2 * x_border;
   else



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]