diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c index c6d1237..91d4d2e 100644 --- a/capplets/display/xrandr-capplet.c +++ b/capplets/display/xrandr-capplet.c @@ -28,6 +28,7 @@ #define GNOME_DESKTOP_USE_UNSTABLE_API #include #include +#include #include #include #include @@ -40,8 +41,9 @@ struct App { GnomeRRScreen *screen; GnomeRRConfig *current_configuration; + GnomeRRLabeler *labeler; GnomeOutputInfo *current_output; - + GtkWidget *dialog; GtkListStore *resolution_store; GtkWidget *resolution_combo; @@ -139,6 +141,13 @@ on_screen_changed (GnomeRRScreen *scr, qsort (app->current_configuration->outputs, i, sizeof (GnomeOutputInfo *), compare_outputs); + if (app->labeler) { + gnome_rr_labeler_hide (app->labeler); + g_object_unref (app->labeler); + } + + app->labeler = gnome_rr_labeler_new (app->current_configuration); + #if 0 for (i = 0; app->current_configuration->outputs[i] != NULL; ++i) { @@ -1351,9 +1360,11 @@ 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); - + foo_scroll_area_get_viewport (FOO_SCROLL_AREA (app->area), &viewport); get_geometry (output, &w, &h); @@ -1419,12 +1430,22 @@ 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); cairo_fill (cr);