From e0ec9acbbbd9ce2df27fffe72480d3c5205a8a1e Mon Sep 17 00:00:00 2001 From: Federico Mena Quintero Date: Sat, 16 Aug 2008 02:00:48 +0000 Subject: [PATCH] Paint the outputs with the color from GnomeRRLabeler Signed-off-by: Federico Mena Quintero svn path=/trunk/; revision=8864 --- capplets/display/ChangeLog | 6 ++++++ capplets/display/xrandr-capplet.c | 20 ++++++++++++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/capplets/display/ChangeLog b/capplets/display/ChangeLog index 1d4d2bbb6..bb21b22e0 100644 --- a/capplets/display/ChangeLog +++ b/capplets/display/ChangeLog @@ -1,3 +1,9 @@ +2008-08-13 Federico Mena Quintero + + * xrandr-capplet.c (paint_output): Instead of using hard-coded + colors for the rectangles that represent the monitors, get the + colors from the GnomeRRLabeler. + 2008-08-13 Federico Mena Quintero * xrandr-capplet.c (on_screen_changed): Create a GnomeRRLabeler diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c index f6fff0a53..faa75a766 100644 --- a/capplets/display/xrandr-capplet.c +++ b/capplets/display/xrandr-capplet.c @@ -1360,6 +1360,8 @@ paint_output (App *app, cairo_t *cr, int i) PangoRectangle extent; GdkRectangle viewport; double angle; + GdkColor output_color; + double r, g, b; cairo_save (cr); @@ -1429,10 +1431,20 @@ paint_output (App *app, cairo_t *cr, int i) cairo_rectangle (cr, x, y, w * scale + 0.5, h * scale + 0.5); cairo_clip_preserve (cr); - if (output->on) - cairo_set_source_rgba (cr, 1.0, 1.0, 1.0, 1.0); - else - cairo_set_source_rgba (cr, 0.2, 0.2, 0.2, 1.0); + gnome_rr_labeler_get_color_for_output (app->labeler, output, &output_color); + r = output_color.red / 65535.0; + g = output_color.green / 65535.0; + b = output_color.blue / 65535.0; + + if (!output->on) + { + /* If the output is turned off, just darken the selected color */ + r *= 0.2; + g *= 0.2; + b *= 0.2; + } + + cairo_set_source_rgba (cr, r, g, b, 1.0); foo_scroll_area_add_input_from_fill (FOO_SCROLL_AREA (app->area), cr, on_output_event, output);