gtk+ r21263 - in trunk: . gtk



Author: cdywan
Date: Wed Sep  3 12:38:32 2008
New Revision: 21263
URL: http://svn.gnome.org/viewvc/gtk+?rev=21263&view=rev

Log:
Bug 547449 â Entry/ Combo popup misplaced after resize

Modified:
   trunk/ChangeLog
   trunk/gtk/gtkcombobox.c
   trunk/gtk/gtkentry.c

Modified: trunk/gtk/gtkcombobox.c
==============================================================================
--- trunk/gtk/gtkcombobox.c	(original)
+++ trunk/gtk/gtkcombobox.c	Wed Sep  3 12:38:32 2008
@@ -1605,8 +1605,9 @@
       gtk_combo_box_menu_position_over (menu, x, y, push_in, user_data);
     }
 
-  gtk_window_set_type_hint (GTK_WINDOW (GTK_MENU (priv->popup_widget)->toplevel),
-                            GDK_WINDOW_TYPE_HINT_COMBO);
+  if (!GTK_WIDGET_VISIBLE (GTK_MENU (priv->popup_widget)->toplevel))
+    gtk_window_set_type_hint (GTK_WINDOW (GTK_MENU (priv->popup_widget)->toplevel),
+                              GDK_WINDOW_TYPE_HINT_COMBO);
 }
 
 static void
@@ -2293,6 +2294,23 @@
               child.width -= child.x;
             }
 
+          if (GTK_WIDGET_VISIBLE (priv->popup_widget))
+            {
+              gint width;
+              GtkRequisition requisition;
+
+              /* Warning here, without the check in the position func */
+              gtk_menu_reposition (GTK_MENU (priv->popup_widget));
+              if (priv->wrap_width == 0)
+                {
+                  width = GTK_WIDGET (combo_box)->allocation.width;
+                  gtk_widget_set_size_request (priv->popup_widget, -1, -1);
+                  gtk_widget_size_request (priv->popup_widget, &requisition);
+                  gtk_widget_set_size_request (priv->popup_widget,
+                    MAX (width, requisition.width), -1);
+               }
+            }
+
 	  child.width = MAX (1, child.width);
 	  child.height = MAX (1, child.height);
           gtk_widget_size_allocate (GTK_BIN (widget)->child, &child);
@@ -2362,6 +2380,15 @@
           child.width -= delta_x * 2;
           child.height -= delta_y * 2;
         }
+
+      if (GTK_WIDGET_VISIBLE (priv->popup_window))
+        {
+          gint x, y, width, height;
+          gtk_combo_box_list_position (combo_box, &x, &y, &width, &height);
+          gtk_window_move (GTK_WINDOW (priv->popup_window), x, y);
+          gtk_widget_set_size_request (priv->popup_window, width, height);
+        }
+
       
       child.width = MAX (1, child.width);
       child.height = MAX (1, child.height);

Modified: trunk/gtk/gtkentry.c
==============================================================================
--- trunk/gtk/gtkentry.c	(original)
+++ trunk/gtk/gtkentry.c	Wed Sep  3 12:38:32 2008
@@ -1581,6 +1581,7 @@
        * be affected by the usize of the entry, if set
        */
       gint x, y, width, height;
+      GtkEntryCompletion* completion;
 
       get_widget_window_size (entry, &x, &y, &width, &height);
       
@@ -1593,6 +1594,10 @@
                               x, y, width, height);
 
       gtk_entry_recompute (entry);
+
+      completion = gtk_entry_get_completion (entry);
+      if (completion && GTK_WIDGET_MAPPED (completion->priv->popup_window))
+        _gtk_entry_completion_resize_popup (completion);
     }
 }
 



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