Updating branch refs/heads/bluesabre/display-settings to 5aa5e499eb2cc8510d00014803f2884350d7ff44 (commit) from 0eb66c7060960b589b4ae9f4dae98e5e224b11fc (commit)
commit 5aa5e499eb2cc8510d00014803f2884350d7ff44 Author: Simon Steinbeiss <simon.steinbe...@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); } _______________________________________________ Xfce4-commits mailing list Xfce4-commits@xfce.org https://mail.xfce.org/mailman/listinfo/xfce4-commits