From ff9e1e7ac4f59444241d7f1b0248f66d30e784b8 Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Sun, 24 Oct 2004 00:43:48 +0000 Subject: [PATCH] Invalidate the window if the tree is empty, to avoid resizing artifacts 2004-10-23 Matthias Clasen * gtk/gtktreeview.c (gtk_tree_view_size_allocate): Invalidate the window if the tree is empty, to avoid resizing artifacts from the focus rectangle. (#155881, Vincent Noel, patch by Billy Biggs) --- ChangeLog | 7 +++++++ ChangeLog.pre-2-10 | 7 +++++++ ChangeLog.pre-2-6 | 7 +++++++ ChangeLog.pre-2-8 | 7 +++++++ gtk/gtktreeview.c | 22 +++++++++++++++++++++- 5 files changed, 49 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 4640ec6460..626abcbb54 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2004-10-23 Matthias Clasen + + * gtk/gtktreeview.c (gtk_tree_view_size_allocate): Invalidate + the window if the tree is empty, to avoid resizing artifacts + from the focus rectangle. (#155881, Vincent Noel, patch by + Billy Biggs) + Sat Oct 23 16:14:37 2004 Søren Sandmann * gtk/gtksequence.c (_gtk_sequence_node_insert_sorted): Remove diff --git a/ChangeLog.pre-2-10 b/ChangeLog.pre-2-10 index 4640ec6460..626abcbb54 100644 --- a/ChangeLog.pre-2-10 +++ b/ChangeLog.pre-2-10 @@ -1,3 +1,10 @@ +2004-10-23 Matthias Clasen + + * gtk/gtktreeview.c (gtk_tree_view_size_allocate): Invalidate + the window if the tree is empty, to avoid resizing artifacts + from the focus rectangle. (#155881, Vincent Noel, patch by + Billy Biggs) + Sat Oct 23 16:14:37 2004 Søren Sandmann * gtk/gtksequence.c (_gtk_sequence_node_insert_sorted): Remove diff --git a/ChangeLog.pre-2-6 b/ChangeLog.pre-2-6 index 4640ec6460..626abcbb54 100644 --- a/ChangeLog.pre-2-6 +++ b/ChangeLog.pre-2-6 @@ -1,3 +1,10 @@ +2004-10-23 Matthias Clasen + + * gtk/gtktreeview.c (gtk_tree_view_size_allocate): Invalidate + the window if the tree is empty, to avoid resizing artifacts + from the focus rectangle. (#155881, Vincent Noel, patch by + Billy Biggs) + Sat Oct 23 16:14:37 2004 Søren Sandmann * gtk/gtksequence.c (_gtk_sequence_node_insert_sorted): Remove diff --git a/ChangeLog.pre-2-8 b/ChangeLog.pre-2-8 index 4640ec6460..626abcbb54 100644 --- a/ChangeLog.pre-2-8 +++ b/ChangeLog.pre-2-8 @@ -1,3 +1,10 @@ +2004-10-23 Matthias Clasen + + * gtk/gtktreeview.c (gtk_tree_view_size_allocate): Invalidate + the window if the tree is empty, to avoid resizing artifacts + from the focus rectangle. (#155881, Vincent Noel, patch by + Billy Biggs) + Sat Oct 23 16:14:37 2004 Søren Sandmann * gtk/gtksequence.c (_gtk_sequence_node_insert_sorted): Remove diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c index 1eb1a3e9bb..be4135cd04 100644 --- a/gtk/gtktreeview.c +++ b/gtk/gtktreeview.c @@ -288,7 +288,7 @@ static void install_presize_handler (GtkTreeView *tree_view); static void install_scroll_sync_handler (GtkTreeView *tree_view); static void gtk_tree_view_dy_to_top_row (GtkTreeView *tree_view); static void gtk_tree_view_top_row_to_dy (GtkTreeView *tree_view); - +static void invalidate_empty_focus (GtkTreeView *tree_view); /* Internal functions */ static gboolean gtk_tree_view_is_expander_column (GtkTreeView *tree_view, @@ -2109,6 +2109,9 @@ gtk_tree_view_size_allocate (GtkWidget *widget, gtk_tree_view_size_allocate_columns (widget); + if (tree_view->priv->tree == NULL) + invalidate_empty_focus (tree_view); + if (GTK_WIDGET_REALIZED (widget)) { gboolean has_expand_column = FALSE; @@ -3353,6 +3356,23 @@ gtk_tree_view_motion (GtkWidget *widget, return FALSE; } +/* Invalidate the focus rectangle near the edge of the bin_window; used when + * the tree is empty. + */ +static void +invalidate_empty_focus (GtkTreeView *tree_view) +{ + GdkRectangle area; + + if (!GTK_WIDGET_HAS_FOCUS (tree_view)) + return; + + area.x = 0; + area.y = 0; + gdk_drawable_get_size (tree_view->priv->bin_window, &area.width, &area.height); + gdk_window_invalidate_rect (tree_view->priv->bin_window, &area, FALSE); +} + /* Draws a focus rectangle near the edge of the bin_window; used when the tree * is empty. */