[gtk/gtk-3-24] treeview: respect expander-size style property
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk/gtk-3-24] treeview: respect expander-size style property
- Date: Fri, 1 Jun 2018 15:06:43 +0000 (UTC)
commit d6a29e1b8cb815a2dfc00cd17681ef13e0487a27
Author: Christian Hergert <chergert redhat com>
Date: Fri May 6 16:12:29 2016 +0300
treeview: respect expander-size style property
Without enforcement to the expander-size, we can end up rendering icons
rather fuzzy. This uses the expander-size style property to determine
the square for the icon, centered on what was the calculated space for
the expander.
gtk/gtktreeview.c | 17 +++++++++++++++++
1 file changed, 17 insertions(+)
---
diff --git a/gtk/gtktreeview.c b/gtk/gtktreeview.c
index 758e3e2168..44ae4fad91 100644
--- a/gtk/gtktreeview.c
+++ b/gtk/gtktreeview.c
@@ -10296,11 +10296,13 @@ gtk_tree_view_draw_arrow (GtkTreeView *tree_view,
gint x2;
gint vertical_separator;
GtkCellRendererState flags = 0;
+ gint expander_size;
widget = GTK_WIDGET (tree_view);
context = gtk_widget_get_style_context (widget);
gtk_widget_style_get (widget,
+ "expander-size", &expander_size,
"vertical-separator", &vertical_separator,
NULL);
@@ -10335,6 +10337,21 @@ gtk_tree_view_draw_arrow (GtkTreeView *tree_view,
gtk_style_context_set_state (context, state);
gtk_style_context_add_class (context, GTK_STYLE_CLASS_EXPANDER);
+ if (expander_size > 0)
+ {
+ if (expander_size < area.width && area.width % expander_size != 0)
+ {
+ area.x += (area.width % expander_size) / 2;
+ area.width = expander_size;
+ }
+
+ if (expander_size < area.height && area.height % expander_size != 0)
+ {
+ area.y += (area.height % expander_size) / 2;
+ area.height = expander_size;
+ }
+ }
+
gtk_render_expander (context, cr,
area.x, area.y,
area.width, area.height);
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]