[gtk+/wip/baedert/meson] treeview: Don't underallocate the drag button



commit dc2de84d2101605c7cacbbf58c85afb1bf40f9fe
Author: Timm Bäder <mail baedert org>
Date:   Sun Sep 25 09:43:29 2016 +0200

    treeview: Don't underallocate the drag button
    
    After unparenting it from the treeview, the column doesn't have a size
    yet so it's allocated width/height is 1×1 (but the x coordinate checks
    out), so instead of asking it for its invalid allocation and then
    allocating it to that size, just query its preferred size and allocate
    it to that.

 gtk/gtktreeview.c |    4 ++++
 1 files changed, 4 insertions(+), 0 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 73d3557..b8dc044 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -10086,8 +10086,12 @@ _gtk_tree_view_column_start_drag (GtkTreeView       *tree_view,
 
   gtk_widget_get_allocation (button, &button_allocation);
   tree_view->priv->drag_column_x = button_allocation.x;
+  gtk_widget_get_preferred_width (button, NULL, &button_allocation.width);
+  gtk_widget_get_preferred_width_for_height (button, button_allocation.width,
+                                             NULL, &button_allocation.height);
   allocation = button_allocation;
   allocation.x = 0;
+  allocation.y =0;
   gtk_widget_size_allocate (button, &allocation);
 
   tree_view->priv->drag_column = column;


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