[gtk+] treeview: Draw background when empty
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] treeview: Draw background when empty
- Date: Sat, 30 Jan 2016 23:32:39 +0000 (UTC)
commit 7d16b8df29824adf1bd0cc1a8f2651b0c04c7f4c
Author: Matthias Clasen <mclasen redhat com>
Date: Sat Jan 30 18:31:30 2016 -0500
treeview: Draw background when empty
We have a function we call for drawing the empty case, but
it only renders a focus rectangle. Make it draw the background
as well.
https://bugzilla.gnome.org/show_bug.cgi?id=761309
gtk/gtktreeview.c | 30 ++++++++++++++----------------
1 files changed, 14 insertions(+), 16 deletions(-)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 9984f92..7fca5f8 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -4798,29 +4798,26 @@ invalidate_empty_focus (GtkTreeView *tree_view)
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.
+/* Draws background and a focus rectangle near the edge of the bin_window;
+ * used when the tree is empty.
*/
static void
-draw_empty_focus (GtkTreeView *tree_view, cairo_t *cr)
+draw_empty (GtkTreeView *tree_view,
+ cairo_t *cr)
{
GtkWidget *widget = GTK_WIDGET (tree_view);
- gint w, h;
+ GtkStyleContext *context;
+ gint width, height;
- if (!gtk_widget_has_visible_focus (widget))
- return;
+ context = gtk_widget_get_style_context (widget);
- w = gdk_window_get_width (tree_view->priv->bin_window) - 2;
- h = gdk_window_get_height (tree_view->priv->bin_window) - 2;
+ width = gdk_window_get_width (tree_view->priv->bin_window);
+ height = gdk_window_get_height (tree_view->priv->bin_window);
- if (w > 0 && h > 0)
- {
- GtkStyleContext *context;
+ gtk_render_background (context, cr, 0, 0, width, height);
- context = gtk_widget_get_style_context (widget);
-
- gtk_render_focus (context, cr, 1, 1, w, h);
- }
+ if (gtk_widget_has_visible_focus (widget))
+ gtk_render_focus (context, cr, 0, 0, width, height);
}
typedef enum {
@@ -4988,7 +4985,7 @@ gtk_tree_view_bin_draw (GtkWidget *widget,
if (tree_view->priv->tree == NULL)
{
- draw_empty_focus (tree_view, cr);
+ draw_empty (tree_view, cr);
return TRUE;
}
@@ -5617,6 +5614,7 @@ gtk_tree_view_draw (GtkWidget *widget,
gtk_cairo_should_draw_window (cr, tree_view->priv->drag_highlight_window))
{
GdkRGBA color;
+
gtk_style_context_get_color (context, gtk_style_context_get_state (context), &color);
cairo_save (cr);
gtk_cairo_transform_to_window (cr, GTK_WIDGET (tree_view), tree_view->priv->drag_highlight_window);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]