summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Clasen <mclasen@redhat.com>2013-05-09 12:06:05 -0400
committerMatthias Clasen <mclasen@redhat.com>2013-05-09 12:06:05 -0400
commit1800dc470910960508d902624f0daf856d4bcc5c (patch)
tree5fddcce319c6a1346fa41c64bfd31d4258e6eddb
parent434dfc20c7403e21046d3a9935992c8bf58e4525 (diff)
downloadgtk+-1800dc470910960508d902624f0daf856d4bcc5c.tar.gz
Remove gtk_widget_size_allocate from gtk_menu_popup_for_device
GtkMenu calls gtk_widget_size_allocate on its GtkWindow during gtk_menu_popup_for_device if the menu has not been realised. This can cause the allocation of the GtkWindow and the size of the GdkWindow to become out of sync because a top level GtkWindow does not attempt to re-size the GdkWindow when its allocation is set. https://bugzilla.gnome.org/show_bug.cgi?id=695120
-rw-r--r--gtk/gtkmenu.c25
1 files changed, 1 insertions, 24 deletions
diff --git a/gtk/gtkmenu.c b/gtk/gtkmenu.c
index d4e392a337..e1b0d9125b 100644
--- a/gtk/gtkmenu.c
+++ b/gtk/gtkmenu.c
@@ -1683,29 +1683,6 @@ gtk_menu_popup_for_device (GtkMenu *menu,
*/
gtk_menu_position (menu, TRUE);
- /* Compute the size of the toplevel and realize it so we
- * can scroll correctly.
- */
- if (!gtk_widget_get_realized (GTK_WIDGET (menu)))
- {
- GtkRequisition tmp_request;
- GtkAllocation tmp_allocation = { 0, };
-
- /* Instead of trusting the menu position function to queue a
- * resize when the menu goes out of bounds, invalidate the cached
- * size here.
- */
- gtk_widget_queue_resize (GTK_WIDGET (menu));
- gtk_widget_get_preferred_size (priv->toplevel, &tmp_request, NULL);
-
- tmp_allocation.width = tmp_request.width;
- tmp_allocation.height = tmp_request.height;
-
- gtk_widget_size_allocate (priv->toplevel, &tmp_allocation);
-
- gtk_widget_realize (priv->toplevel);
- }
-
gtk_menu_scroll_to (menu, priv->scroll_offset);
/* if no item is selected, select the first one */
@@ -2581,7 +2558,7 @@ gtk_menu_realize (GtkWidget *widget)
gtk_widget_get_allocation (widget, &allocation);
attributes.x = 0;
- attributes.y = 0;
+ attributes.y = - priv->scroll_offset;
attributes.width = allocation.width + (2 * border_width) +
padding.left + padding.right;
attributes.height = priv->requested_height - (2 * border_width) +