[Xfce4-commits] <xfce4-settings:master> Improved cairo-drawing of the identification-popups The popups have borders now, which should make them more visible. I also added an offset of +/- 0.5px, which improves the rendering of the arc with cairo (otherwise the corners look thicker than the straight lines)
Nick Schermer
noreply at xfce.org
Sun Oct 28 10:44:35 CET 2012
Updating branch refs/heads/master
to e9b4cc39bd9f2f8a7711c3e5efdb2ad37c183093 (commit)
from c396f9298a902094a5b5ffa69bc60e1461cf6015 (commit)
commit e9b4cc39bd9f2f8a7711c3e5efdb2ad37c183093
Author: Simon Steinbeiss <simon.steinbeiss at elfenbeinturm.at>
Date: Fri Oct 5 23:43:34 2012 +0200
Improved cairo-drawing of the identification-popups
The popups have borders now, which should make them more visible.
I also added an offset of +/- 0.5px, which improves the rendering of the arc with cairo (otherwise the corners look thicker than the straight lines)
dialogs/display-settings/main.c | 37 ++++++++++++-------------------------
1 files changed, 12 insertions(+), 25 deletions(-)
diff --git a/dialogs/display-settings/main.c b/dialogs/display-settings/main.c
index 423228f..6a50c2d 100644
--- a/dialogs/display-settings/main.c
+++ b/dialogs/display-settings/main.c
@@ -1017,46 +1017,33 @@ display_setting_identity_popup_expose(GtkWidget *popup, GdkEventExpose *event, g
gint radius;
radius = 15;
+ cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
/* Compositing is not available, so just set the background color. */
if (!supports_alpha)
{
cairo_set_source_rgb(cr, 0.2, 0.2, 0.2);
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_paint (cr);
}
- /* The radius is tiny, don't bother drawing rounded corners. */
- else if (radius < 0.1) {
- cairo_set_source_rgba(cr, 0.2, 0.2, 0.2, 0.9);
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- cairo_paint (cr);
- cairo_rectangle(cr, 0, 0, popup->allocation.width, popup->allocation.height);
- }
-
/* Draw rounded corners. FIXME Does not work with xfce compositor off. */
else
{
cairo_set_source_rgba(cr, 0, 0, 0, 0);
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
cairo_paint (cr);
+ /* Draw a filled rounded rectangle with outline */
+ cairo_set_line_width(cr, 1.0);
+ cairo_move_to(cr, 0.5, popup->allocation.height+0.5);
+ cairo_line_to(cr, 0.5, radius+0.5);
+ cairo_arc(cr, radius+0.5, radius+0.5, radius, 3.14, 3.0*3.14/2.0);
+ cairo_line_to(cr, popup->allocation.width-0.5 - radius, 0.5);
+ cairo_arc(cr, popup->allocation.width-0.5 - radius, radius+0.5, radius, 3.0*3.14/2.0, 0.0);
+ cairo_line_to(cr, popup->allocation.width-0.5, popup->allocation.height+0.5);
cairo_set_source_rgba(cr, 0.2, 0.2, 0.2, 0.9);
-
- cairo_move_to(cr, 0, radius);
- cairo_arc(cr, radius, radius, radius, 3.14, 3.0*3.14/2.0);
- cairo_line_to(cr, popup->allocation.width - radius, 0);
- cairo_arc(cr, popup->allocation.width - radius, radius, radius, 3.0*3.14/2.0, 0.0);
- //cairo_line_to(cr, popup->allocation.width, popup->allocation.height - radius);
- cairo_line_to(cr, popup->allocation.width, popup->allocation.height);
- //cairo_arc(cr, popup->allocation.width - radius, popup->allocation.height - radius, radius, 0.0, 3.14/2.0);
- //cairo_line_to(cr, radius, popup->allocation.height);
- cairo_line_to(cr, 0, popup->allocation.height);
- //cairo_arc(cr, radius, popup->allocation.height - radius, radius, 3.14/2.0, 3.14);
- cairo_stroke_preserve(cr);
- cairo_set_operator (cr, CAIRO_OPERATOR_SOURCE);
- cairo_fill(cr);
- cairo_set_operator (cr, CAIRO_OPERATOR_OVER);
+ cairo_fill_preserve(cr);
+ cairo_set_source_rgba(cr, 1.0, 1.0, 1.0,0.7);
+ cairo_stroke(cr);
cairo_close_path(cr);
}
More information about the Xfce4-commits
mailing list