diff options
author | Stefano Karapetsas <[email protected]> | 2014-03-07 00:15:43 +0100 |
---|---|---|
committer | Stefano Karapetsas <[email protected]> | 2014-03-07 00:15:43 +0100 |
commit | fcb085d9268aa30958d50500d1f7402d471ec7be (patch) | |
tree | 6569a0c1cb3934e7620f46bf1aa6d1269f707013 /libmate-desktop/mate-rr-labeler.c | |
parent | 9b92002e153b16700fd15ffb32fe15d1b2e09704 (diff) | |
download | mate-desktop-fcb085d9268aa30958d50500d1f7402d471ec7be.tar.bz2 mate-desktop-fcb085d9268aa30958d50500d1f7402d471ec7be.tar.xz |
Revert "gtk3: GdkRGBA support"
This reverts commit e95d24559060365eb4fee8154ad82434bf3c8a0a.
Diffstat (limited to 'libmate-desktop/mate-rr-labeler.c')
-rw-r--r-- | libmate-desktop/mate-rr-labeler.c | 70 |
1 files changed, 1 insertions, 69 deletions
diff --git a/libmate-desktop/mate-rr-labeler.c b/libmate-desktop/mate-rr-labeler.c index c490ed2..2b33526 100644 --- a/libmate-desktop/mate-rr-labeler.c +++ b/libmate-desktop/mate-rr-labeler.c @@ -45,11 +45,7 @@ struct _MateRRLabeler { int num_outputs; -#if GTK_CHECK_VERSION(3, 0, 0) - GdkRGBA *palette; -#else GdkColor *palette; -#endif GtkWidget **windows; GdkScreen *screen; @@ -229,11 +225,7 @@ make_palette (MateRRLabeler *labeler) g_assert (labeler->num_outputs > 0); -#if GTK_CHECK_VERSION(3, 0, 0) - labeler->palette = g_new (GdkRGBA, labeler->num_outputs); -#else labeler->palette = g_new (GdkColor, labeler->num_outputs); -#endif start_hue = 0.0; /* red */ end_hue = 2.0/3; /* blue */ @@ -248,16 +240,9 @@ make_palette (MateRRLabeler *labeler) gtk_hsv_to_rgb (h, s, v, &r, &g, &b); -#if GTK_CHECK_VERSION(3, 0, 0) - labeler->palette[i].red = r; - labeler->palette[i].green = g; - labeler->palette[i].blue = b; - labeler->palette[i].alpha = 1.0; -#else labeler->palette[i].red = (int) (65535 * r + 0.5); labeler->palette[i].green = (int) (65535 * g + 0.5); labeler->palette[i].blue = (int) (65535 * b + 0.5); -#endif } } @@ -271,11 +256,7 @@ label_window_draw_event_cb (GtkWidget *widget, cairo_t *cr, gpointer data) label_window_expose_event_cb (GtkWidget *widget, GdkEventExpose *event, gpointer data) #endif { -#if GTK_CHECK_VERSION(3, 0, 0) - GdkRGBA *color; -#else GdkColor *color; -#endif GtkAllocation allocation; color = g_object_get_data (G_OBJECT (widget), "color"); @@ -298,11 +279,7 @@ label_window_expose_event_cb (GtkWidget *widget, GdkEventExpose *event, gpointer /* fill */ -#if GTK_CHECK_VERSION(3, 0, 0) - gdk_cairo_set_source_rgba (cr, color); -#else gdk_cairo_set_source_color (cr, color); -#endif cairo_rectangle (cr, LABEL_WINDOW_EDGE_THICKNESS, LABEL_WINDOW_EDGE_THICKNESS, @@ -338,21 +315,13 @@ position_window (MateRRLabeler *labeler, } static GtkWidget * -#if GTK_CHECK_VERSION(3, 0, 0) -create_label_window (MateRRLabeler *labeler, MateOutputInfo *output, GdkRGBA *color) -#else create_label_window (MateRRLabeler *labeler, MateOutputInfo *output, GdkColor *color) -#endif { GtkWidget *window; GtkWidget *widget; char *str; const char *display_name; -#if GTK_CHECK_VERSION (3, 0, 0) - GdkRGBA black = { 0.0, 0.0, 0.0, 1.0 }; -#else GdkColor black = { 0, 0, 0, 0 }; -#endif window = gtk_window_new (GTK_WINDOW_POPUP); gtk_widget_set_app_paintable (window, TRUE); @@ -394,11 +363,7 @@ create_label_window (MateRRLabeler *labeler, MateOutputInfo *output, GdkColor *c * theme's colors, since the label is always shown against a light * pastel background. See bgo#556050 */ -#if GTK_CHECK_VERSION(3, 0, 0) - gtk_widget_override_color( widget, gtk_widget_get_state_flags (widget), &black); -#else gtk_widget_modify_fg (widget, gtk_widget_get_state (widget), &black); -#endif gtk_container_add (GTK_CONTAINER (window), widget); @@ -476,31 +441,6 @@ mate_rr_labeler_hide (MateRRLabeler *labeler) } -#if GTK_CHECK_VERSION (3, 0, 0) -void -mate_rr_labeler_get_rgba_for_output (MateRRLabeler *labeler, MateOutputInfo *output, GdkRGBA *color_out) -{ - int i; - - g_return_if_fail (MATE_IS_RR_LABELER (labeler)); - g_return_if_fail (output != NULL); - g_return_if_fail (color_out != NULL); - - for (i = 0; i < labeler->num_outputs; i++) - if (labeler->config->outputs[i] == output) { - *color_out = labeler->palette[i]; - return; - } - - g_warning ("trying to get the color for unknown MateOutputInfo %p; returning magenta!", output); - - color_out->red = 1.0; - color_out->green = 0; - color_out->blue = 1.0; - color_out->alpha = 1.0; -} -#endif - void mate_rr_labeler_get_color_for_output (MateRRLabeler *labeler, MateOutputInfo *output, GdkColor *color_out) { @@ -512,15 +452,7 @@ mate_rr_labeler_get_color_for_output (MateRRLabeler *labeler, MateOutputInfo *ou for (i = 0; i < labeler->num_outputs; i++) if (labeler->config->outputs[i] == output) { -#if GTK_CHECK_VERSION (3, 0, 0) - color_out->red = labeler->palette[i].red * 0xffff; - color_out->green = labeler->palette[i].green * 0xffff; - color_out->blue = labeler->palette[i].blue * 0xffff; -#else - color_out->red = labeler->palette[i].red; - color_out->green = labeler->palette[i].green; - color_out->blue = labeler->palette[i].blue; -#endif + *color_out = labeler->palette[i]; return; } |