diff options
-rw-r--r-- | ChangeLog | 10 | ||||
-rw-r--r-- | gtk/gtkcombobox.c | 31 | ||||
-rw-r--r-- | gtk/gtkentry.c | 5 |
3 files changed, 44 insertions, 2 deletions
@@ -1,3 +1,13 @@ +2008-09-03 Christian Dywan <christian@imendio.com> + + Bug 547449 – Entry/ Combo popup misplaced after resize + + * gtk/gtkcombobox.c (gtk_combo_box_menu_position), + (gtk_combo_box_size_allocate): reposition the combo popup when the + allocation changes + * gtk/gtkentry.c (gtk_entry_size_allocate): reposition the + completion popup when the allocation changes + 2008-09-03 Michael Natterer <mitch@imendio.com> * gtk/gtkmenu.c (get_arrows_visible_area): proper function header diff --git a/gtk/gtkcombobox.c b/gtk/gtkcombobox.c index 1255e7c0e1..df6b601094 100644 --- a/gtk/gtkcombobox.c +++ b/gtk/gtkcombobox.c @@ -1605,8 +1605,9 @@ gtk_combo_box_menu_position (GtkMenu *menu, 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 @@ gtk_combo_box_size_allocate (GtkWidget *widget, 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 @@ gtk_combo_box_size_allocate (GtkWidget *widget, 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); diff --git a/gtk/gtkentry.c b/gtk/gtkentry.c index 4383057ee3..76d17b64ab 100644 --- a/gtk/gtkentry.c +++ b/gtk/gtkentry.c @@ -1581,6 +1581,7 @@ gtk_entry_size_allocate (GtkWidget *widget, * 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 @@ gtk_entry_size_allocate (GtkWidget *widget, 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); } } |