[gtk+] notebook: Improve the style of the default arrows
- From: William Jon McCann <mccann src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] notebook: Improve the style of the default arrows
- Date: Wed, 2 Oct 2013 15:09:19 +0000 (UTC)
commit 8dd100d9b0539bc6bb28c95bdd8e7d5329faf42d
Author: William Jon McCann <william jon mccann gmail com>
Date: Mon Aug 5 16:37:39 2013 +0200
notebook: Improve the style of the default arrows
https://bugzilla.gnome.org/show_bug.cgi?id=707920
gtk/gtkthemingengine.c | 55 +++++++++++++++++++----------------------------
1 files changed, 22 insertions(+), 33 deletions(-)
---
diff --git a/gtk/gtkthemingengine.c b/gtk/gtkthemingengine.c
index ee9a1a4..18f7f74 100644
--- a/gtk/gtkthemingengine.c
+++ b/gtk/gtkthemingengine.c
@@ -1263,26 +1263,6 @@ gtk_theming_engine_render_option (GtkThemingEngine *engine,
}
static void
-add_path_arrow (cairo_t *cr,
- gdouble angle,
- gdouble x,
- gdouble y,
- gdouble size)
-{
- cairo_save (cr);
-
- cairo_translate (cr, x + (size / 2), y + (size / 2));
- cairo_rotate (cr, angle);
-
- cairo_move_to (cr, 0, - (size / 4));
- cairo_line_to (cr, - (size / 2), (size / 4));
- cairo_line_to (cr, (size / 2), (size / 4));
- cairo_close_path (cr);
-
- cairo_restore (cr);
-}
-
-static void
gtk_theming_engine_render_arrow (GtkThemingEngine *engine,
cairo_t *cr,
gdouble angle,
@@ -1290,24 +1270,33 @@ gtk_theming_engine_render_arrow (GtkThemingEngine *engine,
gdouble y,
gdouble size)
{
- GtkStateFlags flags;
- GdkRGBA fg_color;
+ double line_width;
+ GtkStateFlags state;
+ GdkRGBA color;
cairo_save (cr);
- flags = gtk_theming_engine_get_state (engine);
- gtk_theming_engine_get_color (engine, flags, &fg_color);
+ line_width = size / 3.0 / sqrt (2);
+ cairo_set_line_width (cr, line_width);
+ cairo_set_line_join (cr, CAIRO_LINE_JOIN_ROUND);
+ cairo_set_line_cap (cr, CAIRO_LINE_CAP_ROUND);
- if (flags & GTK_STATE_FLAG_INSENSITIVE)
- {
- add_path_arrow (cr, angle, x + 1, y + 1, size);
- cairo_set_source_rgb (cr, 1, 1, 1);
- cairo_fill (cr);
- }
+ cairo_translate (cr, x + size / 2.0, y + size / 2.0);
+ cairo_rotate (cr, angle - G_PI_2);
+ cairo_translate (cr, size / 4.0, 0);
- add_path_arrow (cr, angle, x, y, size);
- gdk_cairo_set_source_rgba (cr, &fg_color);
- cairo_fill (cr);
+ cairo_scale (cr,
+ (size / (size + line_width)),
+ (size / (size + line_width)));
+
+ cairo_move_to (cr, -size / 2.0, -size / 2.0);
+ cairo_rel_line_to (cr, size / 2.0, size / 2.0);
+ cairo_rel_line_to (cr, - size / 2.0, size / 2.0);
+
+ state = gtk_theming_engine_get_state (engine);
+ gtk_theming_engine_get_color (engine, state, &color);
+ gdk_cairo_set_source_rgba (cr, &color);
+ cairo_stroke (cr);
cairo_restore (cr);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]