[gtk+/wip/carlosg/event-delivery: 72/105] gtktreeview: Remove header window
- From: Carlos Garnacho <carlosg src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/carlosg/event-delivery: 72/105] gtktreeview: Remove header window
- Date: Sun, 14 May 2017 23:43:30 +0000 (UTC)
commit d7899e277c16ef38407de5304860d593a000e86e
Author: Carlos Garnacho <carlosg gnome org>
Date: Thu Apr 6 12:53:22 2017 +0200
gtktreeview: Remove header window
It is no longer necessary to overlay the column headers above the
treeview.
gtk/gtktreeprivate.h | 2 -
gtk/gtktreeview.c | 56 ++++++----------------------------------------
gtk/gtktreeviewcolumn.c | 13 +++-------
3 files changed, 12 insertions(+), 59 deletions(-)
---
diff --git a/gtk/gtktreeprivate.h b/gtk/gtktreeprivate.h
index 69006ac..820187e 100644
--- a/gtk/gtktreeprivate.h
+++ b/gtk/gtktreeprivate.h
@@ -82,8 +82,6 @@ GtkRBTree * _gtk_tree_view_get_rbtree (GtkTreeView
GtkTreeViewColumn *_gtk_tree_view_get_focus_column (GtkTreeView *tree_view);
void _gtk_tree_view_set_focus_column (GtkTreeView *tree_view,
GtkTreeViewColumn *column);
-GdkWindow *_gtk_tree_view_get_header_window (GtkTreeView *tree_view);
-
GtkTreeSelection* _gtk_tree_selection_new (void);
GtkTreeSelection* _gtk_tree_selection_new_with_tree_view (GtkTreeView *tree_view);
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 777d606..2519010 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -320,7 +320,6 @@ struct _GtkTreeViewPrivate
/* Sub windows */
GdkWindow *bin_window;
- GdkWindow *header_window;
/* CSS nodes */
GtkCssNode *header_node;
@@ -2196,7 +2195,6 @@ gtk_tree_view_map_buttons (GtkTreeView *tree_view)
else
gdk_window_hide (window);
}
- gdk_window_show (tree_view->priv->header_window);
}
}
@@ -2246,16 +2244,6 @@ gtk_tree_view_realize (GtkWidget *widget)
allocation.height});
gtk_widget_register_window (widget, tree_view->priv->bin_window);
- /* Make the column header window */
- tree_view->priv->header_window = gdk_window_new_child (gtk_widget_get_parent_window (widget),
- GDK_ALL_EVENTS_MASK,
- &(GdkRectangle) {
- 0,
- 0,
- MAX (tree_view->priv->width, allocation.width),
- tree_view->priv->header_height});
- gtk_widget_register_window (widget, tree_view->priv->header_window);
-
tmp_list = tree_view->priv->children;
while (tmp_list)
{
@@ -2331,10 +2319,6 @@ gtk_tree_view_unrealize (GtkWidget *widget)
gdk_window_destroy (priv->bin_window);
priv->bin_window = NULL;
- gtk_widget_unregister_window (widget, priv->header_window);
- gdk_window_destroy (priv->header_window);
- priv->header_window = NULL;
-
if (priv->drag_window)
{
gtk_widget_unregister_window (widget, priv->drag_window);
@@ -2695,11 +2679,6 @@ gtk_tree_view_size_allocate (GtkWidget *widget,
if (gtk_widget_get_realized (widget))
{
- gdk_window_move_resize (tree_view->priv->header_window,
- - (gint) gtk_adjustment_get_value (tree_view->priv->hadjustment),
- 0,
- MAX (tree_view->priv->width, allocation->width),
- tree_view->priv->header_height);
gdk_window_move_resize (tree_view->priv->bin_window,
- (gint) gtk_adjustment_get_value (tree_view->priv->hadjustment),
gtk_tree_view_get_effective_header_height (tree_view),
@@ -3305,7 +3284,6 @@ gtk_tree_view_button_release_drag_column (GtkTreeView *tree_view)
g_object_ref (button);
gtk_container_remove (GTK_CONTAINER (tree_view), button);
- gtk_widget_set_parent_window (button, tree_view->priv->header_window);
gtk_tree_view_update_button_position (tree_view, tree_view->priv->drag_column);
gtk_widget_set_parent (button, GTK_WIDGET (tree_view));
g_object_unref (button);
@@ -3787,7 +3765,7 @@ gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
gtk_widget_get_allocation (button, &drag_allocation);
width = drag_allocation.width;
height = drag_allocation.height;
- tree_view->priv->drag_highlight_window = gdk_window_new_child (tree_view->priv->header_window,
+ tree_view->priv->drag_highlight_window = gdk_window_new_child (gtk_widget_get_window (widget),
GDK_VISIBILITY_NOTIFY_MASK |
GDK_POINTER_MOTION_MASK,
&(GdkRectangle){
tree_view->priv->drag_column_x,
@@ -3801,13 +3779,16 @@ gtk_tree_view_motion_draw_column_motion_arrow (GtkTreeView *tree_view)
}
else if (arrow_type == DRAG_COLUMN_WINDOW_STATE_ARROW)
{
- GtkAllocation button_allocation;
+ GtkAllocation button_allocation, allocation;
GtkWidget *button;
width = gtk_tree_view_get_expander_size (tree_view);
/* Get x, y, width, height of arrow */
- gdk_window_get_origin (tree_view->priv->header_window, &x, &y);
+ gtk_widget_get_allocation (widget, &allocation);
+ x = allocation.x;
+ y = allocation.y;
+
if (reorder->left_column)
{
button = gtk_tree_view_column_get_button (reorder->left_column);
@@ -9712,7 +9693,7 @@ gtk_tree_view_set_column_drag_info (GtkTreeView *tree_view,
}
else
{
- reorder->right_align = gdk_window_get_width (tree_view->priv->header_window)
+ reorder->right_align = gtk_widget_get_allocated_width (GTK_WIDGET (tree_view))
+ TREE_VIEW_COLUMN_DRAG_DEAD_MULTIPLIER (tree_view);
}
}
@@ -9745,7 +9726,7 @@ _gtk_tree_view_column_start_drag (GtkTreeView *tree_view,
gtk_widget_get_allocation (button, &button_allocation);
button_allocation.y = 0;
- tree_view->priv->drag_window = gdk_window_new_child (tree_view->priv->header_window,
+ tree_view->priv->drag_window = gdk_window_new_child (gtk_widget_get_window (GTK_WIDGET (tree_view)),
GDK_VISIBILITY_NOTIFY_MASK | GDK_POINTER_MOTION_MASK,
&button_allocation);
gtk_widget_register_window (GTK_WIDGET (tree_view), tree_view->priv->drag_window);
@@ -9907,12 +9888,6 @@ _gtk_tree_view_get_cursor_node (GtkTreeView *tree_view,
return TRUE;
}
-GdkWindow *
-_gtk_tree_view_get_header_window (GtkTreeView *tree_view)
-{
- return tree_view->priv->header_window;
-}
-
GtkTreeViewColumn *
_gtk_tree_view_get_focus_column (GtkTreeView *tree_view)
{
@@ -11012,9 +10987,6 @@ gtk_tree_view_adjustment_changed (GtkAdjustment *adjustment,
gdk_window_move (tree_view->priv->bin_window,
- gtk_adjustment_get_value (tree_view->priv->hadjustment),
gtk_tree_view_get_effective_header_height (tree_view));
- gdk_window_move (tree_view->priv->header_window,
- - gtk_adjustment_get_value (tree_view->priv->hadjustment),
- 0);
dy = tree_view->priv->dy - (int) gtk_adjustment_get_value (tree_view->priv->vadjustment);
tree_view->priv->in_scroll = TRUE;
gdk_window_scroll (tree_view->priv->bin_window, 0, dy);
@@ -11389,7 +11361,6 @@ gtk_tree_view_set_headers_visible (GtkTreeView *tree_view,
gtk_widget_hide (button);
gtk_widget_unmap (button);
}
- gdk_window_hide (tree_view->priv->header_window);
}
}
@@ -11618,10 +11589,6 @@ gtk_tree_view_remove_column (GtkTreeView *tree_view,
_gtk_tree_view_column_cell_set_dirty (tmp_column, TRUE);
}
- if (tree_view->priv->n_columns == 0 &&
- gtk_tree_view_get_headers_visible (tree_view))
- gdk_window_hide (tree_view->priv->header_window);
-
gtk_widget_queue_resize (GTK_WIDGET (tree_view));
}
@@ -11664,13 +11631,6 @@ gtk_tree_view_insert_column (GtkTreeView *tree_view,
g_object_ref_sink (column);
- if (tree_view->priv->n_columns == 0 &&
- gtk_widget_get_realized (GTK_WIDGET (tree_view)) &&
- gtk_tree_view_get_headers_visible (tree_view))
- {
- gdk_window_show (tree_view->priv->header_window);
- }
-
g_signal_connect (column, "notify::sizing",
G_CALLBACK (column_sizing_notify), tree_view);
diff --git a/gtk/gtktreeviewcolumn.c b/gtk/gtktreeviewcolumn.c
index 76189af..8e20cd1 100644
--- a/gtk/gtktreeviewcolumn.c
+++ b/gtk/gtktreeviewcolumn.c
@@ -973,7 +973,7 @@ gtk_tree_view_column_update_button (GtkTreeViewColumn *tree_column)
gtk_widget_get_realized (priv->tree_view))
{
if (priv->visible &&
- gdk_window_is_visible (_gtk_tree_view_get_header_window (GTK_TREE_VIEW (priv->tree_view))))
+ gtk_tree_view_get_headers_visible (GTK_TREE_VIEW (priv->tree_view)))
{
gtk_widget_show (priv->button);
@@ -1310,13 +1310,12 @@ _gtk_tree_view_column_realize_button (GtkTreeViewColumn *column)
g_return_if_fail (gtk_widget_get_realized (priv->tree_view));
g_return_if_fail (priv->button != NULL);
- g_return_if_fail (_gtk_tree_view_get_header_window (tree_view) != NULL);
- gtk_widget_set_parent_window (priv->button, _gtk_tree_view_get_header_window (tree_view));
+ gtk_widget_set_parent_window (priv->button, gtk_widget_get_window (priv->tree_view));
- display = gdk_window_get_display (_gtk_tree_view_get_header_window (tree_view));
+ display = gtk_widget_get_display (priv->tree_view);
gtk_widget_get_allocation (priv->button, &allocation);
- priv->window = gdk_window_new_input (_gtk_tree_view_get_header_window (tree_view),
+ priv->window = gdk_window_new_input (gtk_widget_get_window (priv->tree_view),
GDK_ALL_EVENTS_MASK,
&(GdkRectangle) {(allocation.x + (rtl ? 0 : allocation.width)) -
TREE_VIEW_DRAG_WIDTH / 2, 0,
TREE_VIEW_DRAG_WIDTH,
_gtk_tree_view_get_header_height (tree_view)});
@@ -1369,10 +1368,6 @@ _gtk_tree_view_column_set_tree_view (GtkTreeViewColumn *column,
priv->tree_view = GTK_WIDGET (tree_view);
- /* make sure we own a reference to it as well. */
- if (_gtk_tree_view_get_header_window (tree_view))
- gtk_widget_set_parent_window (priv->button, _gtk_tree_view_get_header_window (tree_view));
-
gtk_widget_set_parent (priv->button, GTK_WIDGET (tree_view));
priv->property_changed_signal =
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]