From 0c27d18ab5efb721a2f02549767016c81fc6ce2c Mon Sep 17 00:00:00 2001 From: monsta Date: Fri, 2 Dec 2016 00:45:36 +0300 Subject: move to GTK+3 (>= 3.14), drop GTK+2 code and --with-gtk build option and require libmatekbd, libmate-desktop, marco, m-s-d >= 1.17 --- capplets/display/xrandr-capplet.c | 80 --------------------------------------- 1 file changed, 80 deletions(-) (limited to 'capplets/display/xrandr-capplet.c') diff --git a/capplets/display/xrandr-capplet.c b/capplets/display/xrandr-capplet.c index 96b1900e..4a538f43 100644 --- a/capplets/display/xrandr-capplet.c +++ b/capplets/display/xrandr-capplet.c @@ -476,11 +476,7 @@ static void rebuild_current_monitor_label (App *app) { char *str, *tmp; -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA color; -#else - GdkColor color; -#endif gboolean use_color; if (app->current_output) @@ -491,11 +487,7 @@ rebuild_current_monitor_label (App *app) tmp = g_strdup_printf (_("Monitor: %s"), mate_rr_output_info_get_display_name (app->current_output)); str = g_strdup_printf ("%s", tmp); -#if GTK_CHECK_VERSION (3, 0, 0) mate_rr_labeler_get_rgba_for_output (app->labeler, app->current_output, &color); -#else - mate_rr_labeler_get_color_for_output (app->labeler, app->current_output, &color); -#endif use_color = TRUE; g_free (tmp); } @@ -510,7 +502,6 @@ rebuild_current_monitor_label (App *app) if (use_color) { -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA black = { 0, 0, 0, 1.0 }; gtk_widget_override_background_color (app->current_monitor_event_box, gtk_widget_get_state_flags (app->current_monitor_event_box), &color); @@ -520,28 +511,7 @@ rebuild_current_monitor_label (App *app) * pastel background. See bgo#556050 */ gtk_widget_override_color (app->current_monitor_label, gtk_widget_get_state_flags (app->current_monitor_label), &black); -#else - GdkColor black = { 0, 0, 0, 0 }; - - gtk_widget_modify_bg (app->current_monitor_event_box, gtk_widget_get_state (app->current_monitor_event_box), &color); - - /* Make the label explicitly black. We don't want it to follow the - * theme's colors, since the label is always shown against a light - * pastel background. See bgo#556050 - */ - gtk_widget_modify_fg (app->current_monitor_label, gtk_widget_get_state (app->current_monitor_label), &black); -#endif } -#if !GTK_CHECK_VERSION (3, 0, 0) - else - { - /* Remove any modifications we did on the label's color */ - GtkRcStyle *reset_rc_style; - - reset_rc_style = gtk_rc_style_new (); - gtk_widget_modify_style (app->current_monitor_label, reset_rc_style); /* takes ownership of, and destroys, the rc style */ - } -#endif gtk_event_box_set_visible_window (GTK_EVENT_BOX (app->current_monitor_event_box), use_color); } @@ -1503,11 +1473,7 @@ set_cursor (GtkWidget *widget, GdkCursorType type) gdk_window_set_cursor (window, cursor); if (cursor) -#if GTK_CHECK_VERSION (3, 0, 0) g_object_unref (cursor); -#else - gdk_cursor_unref (cursor); -#endif } static void @@ -1680,25 +1646,16 @@ paint_background (FooScrollArea *area, { GdkRectangle viewport; GtkWidget *widget; -#if GTK_CHECK_VERSION (3, 0, 0) GtkStyleContext *widget_style; GdkRGBA *base_color = NULL; GdkRGBA dark_color; -#else - GtkStyle *widget_style; -#endif widget = GTK_WIDGET (area); foo_scroll_area_get_viewport (area, &viewport); -#if GTK_CHECK_VERSION (3, 0, 0) widget_style = gtk_widget_get_style_context (widget); -#else - widget_style = gtk_widget_get_style (widget); -#endif -#if GTK_CHECK_VERSION (3, 0, 0) gtk_style_context_save (widget_style); gtk_style_context_set_state (widget_style, GTK_STATE_FLAG_SELECTED); gtk_style_context_get (widget_style, @@ -1708,12 +1665,6 @@ paint_background (FooScrollArea *area, gtk_style_context_restore (widget_style); gdk_cairo_set_source_rgba(cr, base_color); gdk_rgba_free (base_color); -#else - cairo_set_source_rgb (cr, - widget_style->base[GTK_STATE_SELECTED].red / 65535.0, - widget_style->base[GTK_STATE_SELECTED].green / 65535.0, - widget_style->base[GTK_STATE_SELECTED].blue / 65535.0); -#endif cairo_rectangle (cr, viewport.x, viewport.y, @@ -1723,7 +1674,6 @@ paint_background (FooScrollArea *area, foo_scroll_area_add_input_from_fill (area, cr, on_canvas_event, NULL); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_style_context_save (widget_style); gtk_style_context_set_state (widget_style, GTK_STATE_FLAG_SELECTED); mate_desktop_gtk_style_get_dark_color (widget_style, @@ -1731,12 +1681,6 @@ paint_background (FooScrollArea *area, &dark_color); gtk_style_context_restore (widget_style); gdk_cairo_set_source_rgba (cr, &dark_color); -#else - cairo_set_source_rgb (cr, - widget_style->dark[GTK_STATE_SELECTED].red / 65535.0, - widget_style->dark[GTK_STATE_SELECTED].green / 65535.0, - widget_style->dark[GTK_STATE_SELECTED].blue / 65535.0); -#endif cairo_stroke (cr); } @@ -1755,11 +1699,7 @@ paint_output (App *app, cairo_t *cr, int i) PangoLayout *layout = get_display_name (app, output); PangoRectangle ink_extent, log_extent; GdkRectangle viewport; -#if GTK_CHECK_VERSION (3, 0, 0) GdkRGBA output_color; -#else - GdkColor output_color; -#endif double r, g, b; double available_w; double factor; @@ -1811,17 +1751,10 @@ 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 GTK_CHECK_VERSION (3, 0, 0) mate_rr_labeler_get_rgba_for_output (app->labeler, output, &output_color); r = output_color.red; g = output_color.green; b = output_color.blue; -#else - mate_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; -#endif if (!mate_rr_output_info_is_active (output)) { @@ -1881,19 +1814,10 @@ paint_output (App *app, cairo_t *cr, int i) g_object_unref (layout); } -#if GTK_CHECK_VERSION (3, 0, 0) static void on_area_paint (FooScrollArea *area, cairo_t *cr, gpointer data) -#else -static void -on_area_paint (FooScrollArea *area, - cairo_t *cr, - GdkRectangle *extent, - GdkRegion *region, - gpointer data) -#endif { App *app = data; double scale; @@ -2280,11 +2204,7 @@ get_output_for_window (MateRRConfig *configuration, GdkWindow *window) int largest_index; MateRROutputInfo **outputs; -#if GTK_CHECK_VERSION (3, 0, 0) gdk_window_get_geometry (window, &win_rect.x, &win_rect.y, &win_rect.width, &win_rect.height); -#else - gdk_window_get_geometry (window, &win_rect.x, &win_rect.y, &win_rect.width, &win_rect.height, NULL); -#endif gdk_window_get_origin (window, &win_rect.x, &win_rect.y); largest_area = 0; -- cgit v1.2.1