diff options
author | Philip Chimento <philip@endlessm.com> | 2013-08-01 13:12:16 -0700 |
---|---|---|
committer | Philip Chimento <philip@endlessm.com> | 2013-08-01 19:04:13 -0700 |
commit | c1dc661f6ea250306c6191e476d61ae58941c2c7 (patch) | |
tree | 95870a7f084ae5cbaeb031fb92cf8e483790d7fb /endless/eostopbar.c | |
parent | cd175cbb4a0d9a221be65b6aac314bbfeaac0363 (diff) |
Add top bar edge finishing
Add a highlight and shadow, on the bottom of the top bar; two pixels
go over the top bar, and two pixels go over the app content.
Added a smoke test with a button that turns red on press, in order to
test that the two pixels on top of the app content do not catch input
events.
[endlessm/eos-sdk#197]
Diffstat (limited to 'endless/eostopbar.c')
-rw-r--r-- | endless/eostopbar.c | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/endless/eostopbar.c b/endless/eostopbar.c index eb0b13e..1b78ecf 100644 --- a/endless/eostopbar.c +++ b/endless/eostopbar.c @@ -66,6 +66,30 @@ eos_top_bar_get_preferred_height (GtkWidget *widget, *natural = _EOS_TOP_BAR_HEIGHT_PX; } +/* Draw the edge finishing on the two lines inside the topbar; see +after_draw_cb() in eoswindow.c for the two lines outside the topbar */ +static gboolean +eos_top_bar_draw (GtkWidget *self_widget, + cairo_t *cr) +{ + GTK_WIDGET_CLASS (eos_top_bar_parent_class)->draw (self_widget, cr); + + gint width = gtk_widget_get_allocated_width (self_widget); + cairo_set_line_width (cr, 1.0); + /* Highlight: #ffffff, opacity 5% */ + cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 0.05); + cairo_move_to (cr, 0, _EOS_TOP_BAR_HEIGHT_PX - 2); + cairo_rel_line_to (cr, width, 0); + cairo_stroke (cr); + /* Baseline: #0a0a0a, opacity 100% */ + cairo_set_source_rgb (cr, 0.039, 0.039, 0.039); + cairo_move_to (cr, 0, _EOS_TOP_BAR_HEIGHT_PX - 1); + cairo_rel_line_to (cr, width, 0); + cairo_stroke (cr); + + return GDK_EVENT_PROPAGATE; +} + static void eos_top_bar_class_init (EosTopBarClass *klass) { @@ -75,6 +99,7 @@ eos_top_bar_class_init (EosTopBarClass *klass) g_type_class_add_private (klass, sizeof (EosTopBarPrivate)); widget_class->get_preferred_height = eos_top_bar_get_preferred_height; + widget_class->draw = eos_top_bar_draw; /* * Emitted when the minimize button has been activated. |