diff options
author | monsta <[email protected]> | 2018-01-31 09:46:08 +0300 |
---|---|---|
committer | monsta <[email protected]> | 2018-01-31 09:46:08 +0300 |
commit | ab7987701bcea97e4326fecd161c3137080f6077 (patch) | |
tree | 3e49c11405cc69fab4b8a10ba4342cf70078d22a | |
parent | f553591e0562fd7b4bba0fe6a6182bc0b3747a34 (diff) | |
download | mate-panel-ab7987701bcea97e4326fecd161c3137080f6077.tar.bz2 mate-panel-ab7987701bcea97e4326fecd161c3137080f6077.tar.xz |
require GTK+ 3.22 and GLib 2.50
39 files changed, 42 insertions, 938 deletions
diff --git a/applets/clock/clock-location-tile.c b/applets/clock/clock-location-tile.c index fc331e1d..a4546f71 100644 --- a/applets/clock/clock-location-tile.c +++ b/applets/clock/clock-location-tile.c @@ -277,12 +277,8 @@ clock_location_tile_fill (ClockLocationTile *this) priv->city_label = gtk_label_new (NULL); gtk_widget_set_margin_end (priv->city_label, 3); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (priv->city_label), 0.0); gtk_label_set_yalign (GTK_LABEL (priv->city_label), 0.0); -#else - gtk_misc_set_alignment (GTK_MISC (priv->city_label), 0, 0); -#endif head_section = gtk_box_new (GTK_ORIENTATION_VERTICAL, 0); gtk_box_pack_start (GTK_BOX (head_section), priv->city_label, FALSE, FALSE, 0); @@ -290,12 +286,8 @@ clock_location_tile_fill (ClockLocationTile *this) priv->time_label = gtk_label_new (NULL); gtk_label_set_width_chars (GTK_LABEL (priv->time_label), 20); gtk_widget_set_margin_end (priv->time_label, 3); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (priv->time_label), 0.0); gtk_label_set_yalign (GTK_LABEL (priv->time_label), 0.0); -#else - gtk_misc_set_alignment (GTK_MISC (priv->time_label), 0, 0); -#endif priv->weather_icon = gtk_image_new (); gtk_widget_set_valign (priv->weather_icon, GTK_ALIGN_START); diff --git a/applets/clock/clock-utils.c b/applets/clock/clock-utils.c index 83b08fc6..5b15fe5f 100644 --- a/applets/clock/clock-utils.c +++ b/applets/clock/clock-utils.c @@ -72,13 +72,9 @@ clock_utils_display_help (GtkWidget *widget, uri = g_strdup_printf ("help:%s/%s", doc_id, link_id); else uri = g_strdup_printf ("help:%s", doc_id); -#if GTK_CHECK_VERSION (3, 22, 0) + gtk_show_uri_on_window (NULL, uri, gtk_get_current_event_time (), &error); -#else - gtk_show_uri (gtk_widget_get_screen (widget), uri, - gtk_get_current_event_time (), &error); -#endif g_free (uri); if (error && diff --git a/applets/clock/clock.c b/applets/clock/clock.c index 110e39ee..a17d642e 100644 --- a/applets/clock/clock.c +++ b/applets/clock/clock.c @@ -258,10 +258,6 @@ calculate_minimum_width (GtkWidget *widget, PangoContext *pango_context; PangoLayout *layout; int width, height; -#if !GTK_CHECK_VERSION (3, 20, 0) - int focus_width = 0; - int focus_pad = 0; -#endif GtkStyleContext *style_context; GtkStateFlags state; GtkBorder padding; @@ -278,16 +274,8 @@ calculate_minimum_width (GtkWidget *widget, state = gtk_widget_get_state_flags (widget); style_context = gtk_widget_get_style_context (widget); gtk_style_context_get_padding (style_context, state, &padding); -#if GTK_CHECK_VERSION (3, 20, 0) width += padding.left + padding.right; -#else - gtk_style_context_get_style (style_context, - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, - NULL); - width += 2 * (focus_width + focus_pad) + padding.left + padding.right; -#endif return width; } @@ -384,10 +372,6 @@ calculate_minimum_height (GtkWidget *widget, GtkBorder padding; PangoContext *pango_context; PangoFontMetrics *metrics; -#if !GTK_CHECK_VERSION (3, 20, 0) - int focus_width = 0; - int focus_pad = 0; -#endif int ascent; int descent; int thickness; @@ -407,12 +391,6 @@ calculate_minimum_height (GtkWidget *widget, pango_font_metrics_unref (metrics); gtk_style_context_get_padding (style_context, state, &padding); -#if !GTK_CHECK_VERSION (3, 20, 0) - gtk_style_context_get_style (style_context, - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, - NULL); -#endif if (orientation == MATE_PANEL_APPLET_ORIENT_UP || orientation == MATE_PANEL_APPLET_ORIENT_DOWN) { @@ -421,11 +399,7 @@ calculate_minimum_height (GtkWidget *widget, thickness = padding.left + padding.right; } -#if GTK_CHECK_VERSION (3, 20, 0) return PANGO_PIXELS (ascent + descent) + thickness; -#else - return PANGO_PIXELS (ascent + descent) + 2 * (focus_width + focus_pad) + thickness; -#endif } static gboolean @@ -874,9 +848,7 @@ position_calendar_popup (ClockData *cd) { GtkRequisition req; GtkAllocation allocation; -#if GTK_CHECK_VERSION (3, 22, 0) GdkDisplay *display; -#endif GdkScreen *screen; GdkRectangle monitor; GdkGravity gravity = GDK_GRAVITY_NORTH_WEST; @@ -900,19 +872,11 @@ position_calendar_popup (ClockData *cd) button_h = allocation.height; screen = gtk_window_get_screen (GTK_WINDOW (cd->calendar_popup)); -#if GTK_CHECK_VERSION (3, 22, 0) display = gdk_screen_get_display (screen); n = gdk_display_get_n_monitors (display); -#else - n = gdk_screen_get_n_monitors (screen); -#endif for (i = 0; i < n; i++) { -#if GTK_CHECK_VERSION (3, 22, 0) gdk_monitor_get_geometry (gdk_display_get_monitor (display, i), &monitor); -#else - gdk_screen_get_monitor_geometry (screen, i, &monitor); -#endif if (x >= monitor.x && x <= monitor.x + monitor.width && y >= monitor.y && y <= monitor.y + monitor.height) { found_monitor = TRUE; @@ -1308,7 +1272,6 @@ clock_update_text_gravity (GtkWidget *label) pango_context_set_base_gravity (context, PANGO_GRAVITY_AUTO); } -#if GTK_CHECK_VERSION (3, 20, 0) static inline void force_no_button_padding (GtkWidget *widget) { @@ -1328,30 +1291,6 @@ force_no_button_padding (GtkWidget *widget) gtk_widget_set_name (widget, "clock-applet-button"); } -#else -static inline void -force_no_focus_padding (GtkWidget *widget) -{ - static gboolean first_time = TRUE; - GtkCssProvider *provider; - - if (first_time) { - provider = gtk_css_provider_new (); - gtk_css_provider_load_from_data (provider, - "#clock-applet-button {\n" - " -GtkWidget-focus-line-width: 0px;\n" - " -GtkWidget-focus-padding: 0px; }", - -1, NULL); - gtk_style_context_add_provider (gtk_widget_get_style_context (widget), - GTK_STYLE_PROVIDER (provider), - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - g_object_unref (provider); - first_time = FALSE; - } - - gtk_widget_set_name (widget, "clock-applet-button"); -} -#endif static GtkWidget * create_main_clock_button (void) @@ -1361,11 +1300,7 @@ create_main_clock_button (void) button = gtk_toggle_button_new (); gtk_button_set_relief (GTK_BUTTON (button), GTK_RELIEF_NONE); -#if GTK_CHECK_VERSION (3, 20, 0) force_no_button_padding (button); -#else - force_no_focus_padding (button); -#endif return button; } diff --git a/applets/fish/fish.c b/applets/fish/fish.c index f9e8d6ac..1a1e5807 100644 --- a/applets/fish/fish.c +++ b/applets/fish/fish.c @@ -152,13 +152,9 @@ static void show_help(FishApplet* fish, const char* link_id) uri = g_strdup_printf ("help:%s/%s", FISH_HELP_DOC, link_id); else uri = g_strdup_printf ("help:%s", FISH_HELP_DOC); -#if GTK_CHECK_VERSION (3, 22, 0) + gtk_show_uri_on_window (NULL, uri, gtk_get_current_event_time (), &error); -#else - gtk_show_uri (gtk_widget_get_screen (GTK_WIDGET (fish)), uri, - gtk_get_current_event_time (), &error); -#endif g_free (uri); if (error && @@ -889,13 +885,8 @@ static void display_fortune_dialog(FishApplet* fish) gtk_label_set_ellipsize (GTK_LABEL (fish->fortune_label), PANGO_ELLIPSIZE_MIDDLE); fish->fortune_cmd_label = gtk_label_new (""); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (fish->fortune_cmd_label), 0.0); gtk_label_set_yalign (GTK_LABEL (fish->fortune_cmd_label), 0.5); -#else - gtk_misc_set_alignment (GTK_MISC (fish->fortune_cmd_label), - 0, 0.5); -#endif vbox = gtk_dialog_get_content_area (GTK_DIALOG (fish->fortune_dialog)); gtk_box_pack_start (GTK_BOX (vbox), diff --git a/applets/notification_area/main.c b/applets/notification_area/main.c index 259573c4..069a74b3 100644 --- a/applets/notification_area/main.c +++ b/applets/notification_area/main.c @@ -111,11 +111,7 @@ static void help_cb(GtkAction* action, NaTrayApplet* applet) #define NA_HELP_DOC "mate-user-guide" uri = g_strdup_printf("help:%s/%s", NA_HELP_DOC, "panels-notification-area"); -#if GTK_CHECK_VERSION (3, 22, 0) gtk_show_uri_on_window (NULL, uri, gtk_get_current_event_time (), &error); -#else - gtk_show_uri(gtk_widget_get_screen(GTK_WIDGET(applet)), uri, gtk_get_current_event_time(), &error); -#endif g_free(uri); if (error && g_error_matches (error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) @@ -300,26 +296,6 @@ na_tray_applet_focus (GtkWidget *widget, return GTK_WIDGET_CLASS (na_tray_applet_parent_class)->focus (widget, direction); } -#if !GTK_CHECK_VERSION (3, 20, 0) -static inline void -force_no_focus_padding (GtkWidget *widget) -{ - GtkCssProvider *provider; - - provider = gtk_css_provider_new (); - gtk_css_provider_load_from_data (provider, - "NaTrayApplet {\n" - " -GtkWidget-focus-line-width: 0px;\n" - " -GtkWidget-focus-padding: 0px;\n" - "}", - -1, NULL); - gtk_style_context_add_provider (gtk_widget_get_style_context (widget), - GTK_STYLE_PROVIDER (provider), - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - g_object_unref (provider); -} -#endif - static void na_tray_applet_class_init (NaTrayAppletClass *class) { @@ -361,9 +337,7 @@ na_tray_applet_class_init (NaTrayAppletClass *class) g_type_class_add_private (class, sizeof (NaTrayAppletPrivate)); -#if GTK_CHECK_VERSION (3, 20, 0) gtk_widget_class_set_css_name (widget_class, "na-tray-applet"); -#endif } static void @@ -390,10 +364,6 @@ na_tray_applet_init (NaTrayApplet *applet) mate_panel_applet_set_flags (MATE_PANEL_APPLET (applet), MATE_PANEL_APPLET_HAS_HANDLE|MATE_PANEL_APPLET_EXPAND_MINOR); - -#if !GTK_CHECK_VERSION (3, 20, 0) - force_no_focus_padding (GTK_WIDGET (applet)); -#endif } static gboolean diff --git a/applets/notification_area/status-notifier/sn-dbus-menu.c b/applets/notification_area/status-notifier/sn-dbus-menu.c index 28633990..5b73db00 100644 --- a/applets/notification_area/status-notifier/sn-dbus-menu.c +++ b/applets/notification_area/status-notifier/sn-dbus-menu.c @@ -187,11 +187,11 @@ get_layout_cb (GObject *source_object, g_hash_table_remove_all (menu->items); layout_parse (menu, layout, GTK_MENU (menu)); -#if GTK_CHECK_VERSION (3, 22, 0) + /* Reposition menu to accomodate any size changes */ /* Menu size never changes with GTK 3.20 or earlier */ gtk_menu_reposition(GTK_MENU(menu)); -#endif + g_variant_unref (layout); } diff --git a/applets/notification_area/status-notifier/sn-item-v0.c b/applets/notification_area/status-notifier/sn-item-v0.c index dec9bdf1..46a4c064 100644 --- a/applets/notification_area/status-notifier/sn-item-v0.c +++ b/applets/notification_area/status-notifier/sn-item-v0.c @@ -1372,9 +1372,7 @@ sn_item_v0_class_init (SnItemV0Class *v0_class) widget_class->size_allocate = sn_item_v0_size_allocate; -#if GTK_CHECK_VERSION (3, 20, 0) gtk_widget_class_set_css_name (widget_class, "sn-item"); -#endif install_properties (object_class); } diff --git a/applets/notification_area/status-notifier/sn-item.c b/applets/notification_area/status-notifier/sn-item.c index d2d86ec0..a7fa6fea 100644 --- a/applets/notification_area/status-notifier/sn-item.c +++ b/applets/notification_area/status-notifier/sn-item.c @@ -182,49 +182,6 @@ sn_item_get_action_coordinates (SnItem *item, *x += width; } -#if ! GTK_CHECK_VERSION (3, 22, 0) -static void -sn_item_popup_menu_position_func (GtkMenu *menu, - gint *x, - gint *y, - gboolean *push_in, - gpointer widget) -{ - GtkAllocation widget_alloc; - GtkRequisition menu_req; - GdkWindow *window; - GdkScreen *screen; - gint monitor_num; - GdkRectangle monitor; - - gtk_widget_get_allocation (widget, &widget_alloc); - gtk_widget_get_preferred_size (GTK_WIDGET (menu), &menu_req, NULL); - - window = gtk_widget_get_window (widget); - gdk_window_get_origin (window, x, y); - - *x += widget_alloc.x; - *y += widget_alloc.y; - - screen = gtk_widget_get_screen (widget); - monitor_num = gdk_screen_get_monitor_at_point (screen, *x, *y); - gdk_screen_get_monitor_geometry (screen, monitor_num, &monitor); - - /* put the menu on the left if we can't put it on the right */ - if (*x + menu_req.width > monitor.x + monitor.width) - *x -= menu_req.width - widget_alloc.width; - /* and push it back in if all else failed */ - if (*x < monitor.x) - *x = monitor.x; - - /* put the menu above if we can't put it below */ - if (*y + widget_alloc.height + menu_req.height > monitor.y + monitor.height) - *y -= menu_req.height; - else - *y += widget_alloc.height; -} -#endif - static gboolean sn_item_button_press_event (GtkWidget *widget, GdkEventButton *event) @@ -244,39 +201,23 @@ sn_item_button_press_event (GtkWidget *widget, if (event->button == 2) { -#if GTK_CHECK_VERSION (3, 20, 0) gdk_seat_ungrab (gdk_device_get_seat (event->device)); -#else - gdk_device_ungrab (event->device, GDK_CURRENT_TIME); -#endif SN_ITEM_GET_CLASS (item)->secondary_activate (item, x, y); } else if (event->button == 3) { if (priv->menu != NULL) { -#if GTK_CHECK_VERSION (3, 22, 0) gtk_menu_popup_at_widget (priv->menu, widget, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, (GdkEvent *) event); /*Fix positioning if size changed since last shown*/ gtk_menu_reposition(priv->menu); -#else - gtk_menu_popup (priv->menu, NULL, NULL, - sn_item_popup_menu_position_func, widget, - event->button, event->time); - /*Fix positioning if size changed since last shown*/ - gtk_menu_reposition(priv->menu); -#endif } else { -#if GTK_CHECK_VERSION (3, 20, 0) gdk_seat_ungrab (gdk_device_get_seat (event->device)); -#else - gdk_device_ungrab (event->device, GDK_CURRENT_TIME); -#endif SN_ITEM_GET_CLASS (item)->context_menu (item, x, y); } } @@ -299,30 +240,12 @@ sn_item_popup_menu (GtkWidget *widget) if (priv->menu != NULL) { -#if GTK_CHECK_VERSION (3, 22, 0) gtk_menu_popup_at_widget (priv->menu, widget, GDK_GRAVITY_SOUTH_WEST, GDK_GRAVITY_NORTH_WEST, NULL); /*Fix positioning if size changed since last shown*/ gtk_menu_reposition(priv->menu); -#else - guint button = 0; - guint32 active_time = GDK_CURRENT_TIME; - GdkEvent *event = gtk_get_current_event (); - - if (event) - { - gdk_event_get_button (event, &button); - active_time = gdk_event_get_time (event); - } - - gtk_menu_popup (priv->menu, NULL, NULL, - sn_item_popup_menu_position_func, widget, - button, active_time); - /*Fix positioning if size changed since last shown*/ - gtk_menu_reposition(priv->menu); -#endif } else { diff --git a/applets/notification_area/system-tray/fixedtip.c b/applets/notification_area/system-tray/fixedtip.c index d233424e..2278e9ca 100644 --- a/applets/notification_area/system-tray/fixedtip.c +++ b/applets/notification_area/system-tray/fixedtip.c @@ -117,12 +117,8 @@ na_fixed_tip_init (NaFixedTip *fixedtip) label = gtk_label_new (NULL); gtk_label_set_line_wrap (GTK_LABEL (label), TRUE); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (label), 0.5); gtk_label_set_yalign (GTK_LABEL (label), 0.5); -#else - gtk_misc_set_alignment (GTK_MISC (label), 0.5, 0.5); -#endif gtk_widget_show (label); gtk_container_add (GTK_CONTAINER (fixedtip), label); fixedtip->priv->label = label; diff --git a/applets/notification_area/testtray.c b/applets/notification_area/testtray.c index cc36c02f..80f8fba0 100644 --- a/applets/notification_area/testtray.c +++ b/applets/notification_area/testtray.c @@ -164,13 +164,10 @@ create_tray_on_screen (GdkScreen *screen, hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 12); gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 0); label = gtk_label_new_with_mnemonic ("_Orientation:"); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_label_set_yalign (GTK_LABEL (label), 0.5); -#else - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); -#endif gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); + combo = gtk_combo_box_text_new (); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "Horizontal"); gtk_combo_box_text_append_text (GTK_COMBO_BOX_TEXT (combo), "Vertical"); @@ -180,12 +177,8 @@ create_tray_on_screen (GdkScreen *screen, label = gtk_label_new (NULL); data->count_label = GTK_LABEL (label); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_label_set_yalign (GTK_LABEL (label), 0.5); -#else - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); -#endif gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0); data->traybox = na_box_new (GTK_ORIENTATION_HORIZONTAL); diff --git a/applets/wncklet/showdesktop.c b/applets/wncklet/showdesktop.c index 57818774..c1ab01ca 100644 --- a/applets/wncklet/showdesktop.c +++ b/applets/wncklet/showdesktop.c @@ -138,10 +138,6 @@ static void update_icon(ShowDesktopData* sdd) GdkPixbuf* scaled; int icon_size; GError* error; -#if !GTK_CHECK_VERSION (3, 20, 0) - int focus_width = 0; - int focus_pad = 0; -#endif int thickness = 0; if (!sdd->icon_theme) @@ -150,12 +146,6 @@ static void update_icon(ShowDesktopData* sdd) state = gtk_widget_get_state_flags (sdd->button); context = gtk_widget_get_style_context (sdd->button); gtk_style_context_get_padding (context, state, &padding); -#if !GTK_CHECK_VERSION (3, 20, 0) - gtk_style_context_get_style (context, - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, - NULL); -#endif switch (sdd->orient) { case GTK_ORIENTATION_HORIZONTAL: @@ -165,11 +155,8 @@ static void update_icon(ShowDesktopData* sdd) thickness = padding.left + padding.right; break; } -#if GTK_CHECK_VERSION (3, 20, 0) + icon_size = sdd->size - thickness; -#else - icon_size = sdd->size - 2 * (focus_width + focus_pad) - thickness; -#endif if (icon_size < 22) icon_size = 16; @@ -418,7 +405,6 @@ gboolean show_desktop_applet_fill(MatePanelApplet* applet) gtk_widget_set_name (sdd->button, "showdesktop-button"); provider = gtk_css_provider_new (); -#if GTK_CHECK_VERSION (3, 20, 0) gtk_css_provider_load_from_data (provider, "#showdesktop-button {\n" "border-width: 0px; \n" /*a border here causes GTK warnings */ @@ -430,18 +416,6 @@ gboolean show_desktop_applet_fill(MatePanelApplet* applet) GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (provider); -#else - gtk_css_provider_load_from_data (provider, - "#showdesktop-button {\n" - " -GtkWidget-focus-line-width: 0px;\n" - " -GtkWidget-focus-padding: 0px; }", - -1, NULL); - - gtk_style_context_add_provider (gtk_widget_get_style_context (sdd->button), - GTK_STYLE_PROVIDER (provider), - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - g_object_unref (provider); -#endif atk_obj = gtk_widget_get_accessible(sdd->button); atk_object_set_name (atk_obj, _("Show Desktop Button")); diff --git a/applets/wncklet/window-list.c b/applets/wncklet/window-list.c index 9cbe97f5..c7810588 100644 --- a/applets/wncklet/window-list.c +++ b/applets/wncklet/window-list.c @@ -373,14 +373,13 @@ gboolean window_list_applet_fill(MatePanelApplet* applet) TasklistData* tasklist; GtkActionGroup* action_group; gchar* ui_path; -#if GTK_CHECK_VERSION (3, 20, 0) GtkCssProvider *provider; GdkScreen *screen; -#endif + tasklist = g_new0(TasklistData, 1); tasklist->applet = GTK_WIDGET(applet); -#if GTK_CHECK_VERSION (3, 20, 0) + provider = gtk_css_provider_new (); screen = gdk_screen_get_default (); gtk_css_provider_load_from_data (provider, @@ -393,7 +392,7 @@ gboolean window_list_applet_fill(MatePanelApplet* applet) GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); g_object_unref (provider); -#endif + mate_panel_applet_set_flags(MATE_PANEL_APPLET(tasklist->applet), MATE_PANEL_APPLET_EXPAND_MAJOR | MATE_PANEL_APPLET_EXPAND_MINOR | MATE_PANEL_APPLET_HAS_HANDLE); setup_gsettings(tasklist); diff --git a/applets/wncklet/window-menu.c b/applets/wncklet/window-menu.c index 0db9fee2..5deb32e9 100644 --- a/applets/wncklet/window-menu.c +++ b/applets/wncklet/window-menu.c @@ -145,27 +145,6 @@ static gboolean window_menu_on_draw (GtkWidget* widget, return FALSE; } -#if !GTK_CHECK_VERSION (3, 20, 0) -static inline void force_no_focus_padding(GtkWidget* widget) -{ - GtkCssProvider *provider; - - provider = gtk_css_provider_new (); - gtk_css_provider_load_from_data (provider, - "#PanelApplet-window-menu-applet-button {\n" - " border-width: 0px;\n" - " -GtkWidget-focus-line-width: 0px;\n" - " -GtkWidget-focus-padding: 0px; }", - -1, NULL); - gtk_style_context_add_provider (gtk_widget_get_style_context (widget), - GTK_STYLE_PROVIDER (provider), - GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); - g_object_unref (provider); - - gtk_widget_set_name(widget, "PanelApplet-window-menu-applet-button"); -} -#endif - static void window_menu_size_allocate(MatePanelApplet* applet, GtkAllocation* allocation, WindowMenu* window_menu) { MatePanelAppletOrient orient; @@ -247,11 +226,7 @@ gboolean window_menu_applet_fill(MatePanelApplet* applet) window_menu = g_new0(WindowMenu, 1); window_menu->applet = GTK_WIDGET(applet); -#if GTK_CHECK_VERSION (3, 20, 0) gtk_widget_set_name (window_menu->applet, "window-menu-applet-button"); -#else - force_no_focus_padding(window_menu->applet); -#endif gtk_widget_set_tooltip_text(window_menu->applet, _("Window Selector")); mate_panel_applet_set_flags(applet, MATE_PANEL_APPLET_EXPAND_MINOR); diff --git a/applets/wncklet/wncklet.c b/applets/wncklet/wncklet.c index 9d863081..dafdcb8f 100644 --- a/applets/wncklet/wncklet.c +++ b/applets/wncklet/wncklet.c @@ -49,11 +49,8 @@ void wncklet_display_help(GtkWidget* widget, const char* doc_id, const char* lin uri = g_strdup_printf("help:%s/%s", doc_id, link_id); else uri = g_strdup_printf("help:%s", doc_id); -#if GTK_CHECK_VERSION (3, 22, 0) + gtk_show_uri_on_window (NULL, uri, gtk_get_current_event_time (), &error); -#else - gtk_show_uri(gtk_widget_get_screen(widget), uri, gtk_get_current_event_time(), &error); -#endif g_free(uri); if (error && g_error_matches(error, G_IO_ERROR, G_IO_ERROR_CANCELLED)) diff --git a/configure.ac b/configure.ac index 32dcb343..b1c49d0b 100644 --- a/configure.ac +++ b/configure.ac @@ -29,10 +29,6 @@ AC_PROG_LIBTOOL #AC_PROG_SED available in 2.59b AM_PROG_CC_C_O -# GLib min required versions -AC_DEFINE([GLIB_VERSION_MIN_REQUIRED], [GLIB_VERSION_2_36], - [Warn on use of APIs deprecated before GLib 2.36]) - AC_PATH_PROG(GLIB_GENMARSHAL, glib-genmarshal) AC_PATH_PROG([GDBUS_CODEGEN], [gdbus-codegen]) @@ -60,13 +56,13 @@ LT_LIB_M LIBMATE_DESKTOP_REQUIRED=1.17.0 GDK_PIXBUF_REQUIRED=2.7.1 PANGO_REQUIRED=1.15.4 -GLIB_REQUIRED=2.36 +GLIB_REQUIRED=2.50.0 LIBMATE_MENU_REQUIRED=1.10.0 CAIRO_REQUIRED=1.0.0 DBUS_GLIB_REQUIRED=0.80 DCONF_REQUIRED=0.13.4 LIBRSVG_REQUIRED=2.36.2 -GTK_REQUIRED=3.14.0 +GTK_REQUIRED=3.22.0 LIBWNCK_REQUIRED=3.4.6 WEATHER_REQUIRED=1.17.0 diff --git a/libmate-panel-applet/mate-panel-applet.c b/libmate-panel-applet/mate-panel-applet.c index 3c71851c..0b554404 100644 --- a/libmate-panel-applet/mate-panel-applet.c +++ b/libmate-panel-applet/mate-panel-applet.c @@ -46,9 +46,8 @@ #include "mate-panel-applet-factory.h" #include "mate-panel-applet-marshal.h" #include "mate-panel-applet-enums.h" -#if GTK_CHECK_VERSION (3, 18, 0) #include "panel-plug-private.h" -#endif + #define MATE_PANEL_APPLET_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), PANEL_TYPE_APPLET, MatePanelAppletPrivate)) struct _MatePanelAppletPrivate { @@ -72,9 +71,6 @@ struct _MatePanelAppletPrivate { MatePanelAppletOrient orient; guint size; char *background; -#if !GTK_CHECK_VERSION (3, 18, 0) - GtkWidget *background_widget; -#endif int previous_width; int previous_height; @@ -807,13 +803,10 @@ mate_panel_applet_position_menu (GtkMenu *menu, gtk_widget_get_preferred_size (GTK_WIDGET (menu), &requisition, NULL); gdk_window_get_origin (gtk_widget_get_window (widget), &menu_x, &menu_y); -#if GTK_CHECK_VERSION (3, 20, 0) + device = gdk_seat_get_pointer (gdk_display_get_default_seat (gtk_widget_get_display (widget))); gdk_window_get_device_position (gtk_widget_get_window (widget), device, &pointer_x, &pointer_y, NULL); -#else - device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gtk_widget_get_display (widget))); - gdk_window_get_device_position (gtk_widget_get_window (widget), device, &pointer_x, &pointer_y, NULL); -#endif + gtk_widget_get_allocation (widget, &allocation); menu_x += allocation.x; @@ -924,7 +917,6 @@ mate_panel_applet_button_event (MatePanelApplet *applet, socket_window = gtk_plug_get_socket_window (GTK_PLUG (widget)); if (event->type == GDK_BUTTON_PRESS) { -#if GTK_CHECK_VERSION (3, 20, 0) GdkDisplay *display; GdkSeat *seat; @@ -939,16 +931,6 @@ mate_panel_applet_button_event (MatePanelApplet *applet, * We don't want to hog the pointer on our parent. */ gdk_seat_ungrab (seat); -#else - xevent.xbutton.type = ButtonPress; - - /* X does an automatic pointer grab on button press - * if we have both button press and release events - * selected. - * We don't want to hog the pointer on our parent. - */ - gdk_device_ungrab (event->device, GDK_CURRENT_TIME); -#endif } else { xevent.xbutton.type = ButtonRelease; } @@ -1042,22 +1024,6 @@ mate_panel_applet_get_preferred_width (GtkWidget *widget, *natural_width /= scale; } } - -#if !GTK_CHECK_VERSION (3, 18, 0) - if (mate_panel_applet_can_focus (widget)) { - int focus_width = 0; - - /* We are deliberately ignoring focus-padding here to - * save valuable panel real estate. - */ - gtk_widget_style_get (widget, - "focus-line-width", &focus_width, - NULL); - - *minimum_width += 2 * focus_width; - *natural_width += 2 * focus_width; - } -#endif } static void @@ -1082,22 +1048,6 @@ mate_panel_applet_get_preferred_height (GtkWidget *widget, *natural_height /= scale; } } - -#if !GTK_CHECK_VERSION (3, 18, 0) - if (mate_panel_applet_can_focus (widget)) { - int focus_width = 0; - - /* We are deliberately ignoring focus-padding here to - * save valuable panel real estate. - */ - gtk_widget_style_get (widget, - "focus-line-width", &focus_width, - NULL); - - *minimum_height += 2 * focus_width; - *natural_height += 2 * focus_width; - } -#endif } static GtkSizeRequestMode @@ -1122,36 +1072,19 @@ mate_panel_applet_size_allocate (GtkWidget *widget, GtkBin *bin; GtkWidget *child; int border_width; -#if !GTK_CHECK_VERSION (3, 18, 0) - int focus_width = 0; -#endif MatePanelApplet *applet; if (!mate_panel_applet_can_focus (widget)) { GTK_WIDGET_CLASS (mate_panel_applet_parent_class)->size_allocate (widget, allocation); } else { -#if !GTK_CHECK_VERSION (3, 18, 0) - /* - * We are deliberately ignoring focus-padding here to - * save valuable panel real estate. - */ - gtk_widget_style_get (widget, - "focus-line-width", &focus_width, - NULL); -#endif border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); gtk_widget_set_allocation (widget, allocation); bin = GTK_BIN (widget); -#if GTK_CHECK_VERSION (3, 18, 0) child_allocation.x = 0; child_allocation.y = 0; -#else - child_allocation.x = focus_width; - child_allocation.y = focus_width; -#endif child_allocation.width = MAX (allocation->width - border_width * 2, 0); child_allocation.height = MAX (allocation->height - border_width * 2, 0); @@ -1163,11 +1096,6 @@ mate_panel_applet_size_allocate (GtkWidget *widget, child_allocation.width, child_allocation.height); -#if !GTK_CHECK_VERSION (3, 18, 0) - child_allocation.width = MAX (child_allocation.width - 2 * focus_width, 0); - child_allocation.height = MAX (child_allocation.height - 2 * focus_width, 0); -#endif - child = gtk_bin_get_child (bin); if (child) gtk_widget_size_allocate (child, &child_allocation); @@ -1188,9 +1116,6 @@ static gboolean mate_panel_applet_draw(GtkWidget* widget, cairo_t* cr) { GtkStyleContext *context; int border_width; -#if !GTK_CHECK_VERSION (3, 18, 0) - int focus_width = 0; -#endif gdouble x, y, width, height; GTK_WIDGET_CLASS (mate_panel_applet_parent_class)->draw(widget, cr); @@ -1201,16 +1126,6 @@ static gboolean mate_panel_applet_draw(GtkWidget* widget, cairo_t* cr) width = gtk_widget_get_allocated_width (widget); height = gtk_widget_get_allocated_height (widget); -#if !GTK_CHECK_VERSION (3, 18, 0) - /* - * We are deliberately ignoring focus-padding here to - * save valuable panel real estate. - */ - gtk_widget_style_get (widget, - "focus-line-width", &focus_width, - NULL); -#endif - border_width = gtk_container_get_border_width (GTK_CONTAINER (widget)); x = 0; @@ -1576,14 +1491,11 @@ mate_panel_applet_change_background(MatePanelApplet *applet, { GtkStyleContext* context; GdkWindow* window; -#if GTK_CHECK_VERSION (3, 18, 0) + if (applet->priv->out_of_process) window = gtk_widget_get_window (applet->priv->plug); else window = gtk_widget_get_window GTK_WIDGET((applet)); -#else - window = gtk_widget_get_window GTK_WIDGET((applet)); -#endif gtk_widget_set_app_paintable(GTK_WIDGET(applet),TRUE); @@ -1600,21 +1512,13 @@ mate_panel_applet_change_background(MatePanelApplet *applet, case PANEL_COLOR_BACKGROUND: if (applet->priv->out_of_process){ gdk_window_set_background_rgba(window,color); -#if GTK_CHECK_VERSION (3, 18, 0) gtk_widget_queue_draw (applet->priv->plug); /*change the bg right away always */ -#else - gtk_widget_queue_draw (GTK_WIDGET(applet)); -#endif } break; case PANEL_PIXMAP_BACKGROUND: if (applet->priv->out_of_process){ gdk_window_set_background_pattern(window,pattern); -#if GTK_CHECK_VERSION (3, 18, 0) gtk_widget_queue_draw (applet->priv->plug); /*change the bg right away always */ -#else - gtk_widget_queue_draw (GTK_WIDGET(applet)); -#endif } break; default: @@ -1835,7 +1739,6 @@ static void _mate_panel_applet_prepare_css (GtkStyleContext *context) GtkCssProvider *provider; provider = gtk_css_provider_new (); -#if GTK_CHECK_VERSION (3, 18, 0) gtk_css_provider_load_from_data (provider, "#PanelPlug {\n" " background-repeat: no-repeat;\n" /*disable in gtk theme features */ @@ -1846,14 +1749,7 @@ static void _mate_panel_applet_prepare_css (GtkStyleContext *context) " background-image: none;\n" "}", -1, NULL); -#else -gtk_css_provider_load_from_data (provider, - ".mate-custom-panel-background{\n" /*prepare CSS for user set theme */ - " background-color: rgba (0, 0, 0, 0);\n" - " background-image: none;\n" - "}", - -1, NULL); -#endif + gtk_style_context_add_provider (context, GTK_STYLE_PROVIDER (provider), GTK_STYLE_PROVIDER_PRIORITY_APPLICATION); @@ -2116,9 +2012,7 @@ mate_panel_applet_class_init (MatePanelAppletClass *klass) add_tab_bindings (binding_set, GDK_CONTROL_MASK, GTK_DIR_TAB_FORWARD); add_tab_bindings (binding_set, GDK_CONTROL_MASK | GDK_SHIFT_MASK, GTK_DIR_TAB_BACKWARD); -#if GTK_CHECK_VERSION (3, 20, 0) gtk_widget_class_set_css_name (widget_class, "PanelApplet"); -#endif } GtkWidget* mate_panel_applet_new(void) @@ -2437,31 +2331,11 @@ mate_panel_applet_factory_setup_in_process (const gchar *factory_i * Deprecated: 3.20: Do not use this API. Since 3.20 this function does nothing. **/ -#if GTK_CHECK_VERSION (3, 18, 0) void mate_panel_applet_set_background_widget (MatePanelApplet *applet, GtkWidget *widget) { } -#else -void -mate_panel_applet_set_background_widget (MatePanelApplet *applet, - GtkWidget *widget) -{ - applet->priv->background_widget = widget; - - if (widget && gtk_widget_get_realized (widget)) { - MatePanelAppletBackgroundType type; - GdkRGBA color; - cairo_pattern_t *pattern; - type = mate_panel_applet_get_background (applet, &color, &pattern); - _mate_panel_applet_apply_css(widget,type); - - if (type == PANEL_PIXMAP_BACKGROUND) - cairo_pattern_destroy (pattern); - } -} -#endif guint32 mate_panel_applet_get_xid (MatePanelApplet *applet, diff --git a/libmate-panel-applet/panel-plug-private.h b/libmate-panel-applet/panel-plug-private.h index 030540fd..0940b70f 100644 --- a/libmate-panel-applet/panel-plug-private.h +++ b/libmate-panel-applet/panel-plug-private.h @@ -19,8 +19,6 @@ #define PANEL_PLUG_PRIVATE_H #include <gtk/gtk.h> - -#if GTK_CHECK_VERSION (3, 18, 0) #include <gtk/gtkx.h> G_BEGIN_DECLS @@ -37,4 +35,3 @@ GtkWidget *panel_plug_new (void); G_END_DECLS #endif -#endif diff --git a/libmate-panel-applet/panel-plug.c b/libmate-panel-applet/panel-plug.c index b4558c8b..10dd4099 100644 --- a/libmate-panel-applet/panel-plug.c +++ b/libmate-panel-applet/panel-plug.c @@ -17,7 +17,6 @@ #include <gtk/gtk.h> -#if GTK_CHECK_VERSION (3, 18, 0) #include "panel-plug-private.h" struct _PanelPlug @@ -83,9 +82,7 @@ panel_plug_class_init (PanelPlugClass *plug_class) widget_class->draw = panel_plug_draw; widget_class->realize = panel_plug_realize; -#if GTK_CHECK_VERSION (3, 20, 0) gtk_widget_class_set_css_name (widget_class, "PanelApplet"); -#endif } static void @@ -99,4 +96,3 @@ panel_plug_new (void) { return g_object_new (PANEL_TYPE_PLUG, NULL); } -#endif diff --git a/mate-panel/applet.c b/mate-panel/applet.c index 13f31d7e..92ec8762 100644 --- a/mate-panel/applet.c +++ b/mate-panel/applet.c @@ -651,13 +651,10 @@ mate_panel_applet_position_menu (GtkMenu *menu, gtk_widget_get_preferred_size (GTK_WIDGET (menu), &requisition, NULL); gdk_window_get_origin (gtk_widget_get_window (applet), &menu_x, &menu_y); -#if GTK_CHECK_VERSION(3, 20, 0) + device = gdk_seat_get_pointer (gdk_display_get_default_seat (gtk_widget_get_display (applet))); gdk_window_get_device_position (gtk_widget_get_window (applet), device, &pointer_x, &pointer_y, NULL); -#else - device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gtk_widget_get_display (applet))); - gdk_window_get_device_position (gtk_widget_get_window (applet), device, &pointer_x, &pointer_y, NULL); -#endif + gtk_widget_get_allocation (applet, &allocation); if (!gtk_widget_get_has_window (applet)) { diff --git a/mate-panel/button-widget.c b/mate-panel/button-widget.c index e3f0fa63..94d031f0 100644 --- a/mate-panel/button-widget.c +++ b/mate-panel/button-widget.c @@ -415,29 +415,11 @@ button_widget_draw (GtkWidget *widget, } if (gtk_widget_has_focus (widget)) { -#if !GTK_CHECK_VERSION (3, 20, 0) - gint focus_pad; -#endif - gtk_style_context_save (context); gtk_style_context_set_state (context, state_flags); -#if !GTK_CHECK_VERSION (3, 20, 0) - gtk_widget_style_get (widget, - "focus-padding", &focus_pad, - NULL); - x = focus_pad; - y = focus_pad; - w = width - 2 * focus_pad; - h = height - 2 * focus_pad; -#endif - cairo_save (cr); -#if GTK_CHECK_VERSION (3, 20, 0) gtk_render_focus (context, cr, 0, 0, width, height); -#else - gtk_render_focus (context, cr, x, y, w, h); -#endif cairo_restore (cr); gtk_style_context_restore (context); diff --git a/mate-panel/launcher.c b/mate-panel/launcher.c index 07e52e40..d8d65ad1 100644 --- a/mate-panel/launcher.c +++ b/mate-panel/launcher.c @@ -540,7 +540,6 @@ create_launcher (const char *location) return launcher; } -#if GLIB_CHECK_VERSION (2, 38, 0) static void setup_actions (Launcher *launcher) { @@ -569,7 +568,6 @@ setup_actions (Launcher *launcher) g_object_unref (app_info); } -#endif static void setup_button (Launcher *launcher) @@ -590,9 +588,7 @@ setup_button (Launcher *launcher) _("_Launch"), NULL); -#if GLIB_CHECK_VERSION (2, 38, 0) setup_actions (launcher); -#endif mate_panel_applet_add_callback (launcher->info, "properties", diff --git a/mate-panel/libmate-panel-applet-private/panel-applet-frame-dbus.c b/mate-panel/libmate-panel-applet-private/panel-applet-frame-dbus.c index e9657648..006bdb0a 100644 --- a/mate-panel/libmate-panel-applet-private/panel-applet-frame-dbus.c +++ b/mate-panel/libmate-panel-applet-private/panel-applet-frame-dbus.c @@ -381,10 +381,8 @@ mate_panel_applet_frame_dbus_class_init (MatePanelAppletFrameDBusClass *class) frame_class->change_size = mate_panel_applet_frame_dbus_change_size; frame_class->change_background = mate_panel_applet_frame_dbus_change_background; -#if GTK_CHECK_VERSION (3, 20, 0) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (class); gtk_widget_class_set_css_name (widget_class, "MatePanelAppletFrameDBus"); -#endif g_type_class_add_private (class, sizeof (MatePanelAppletFrameDBusPrivate)); } diff --git a/mate-panel/libpanel-util/panel-show.c b/mate-panel/libpanel-util/panel-show.c index a4c7f6d7..19feac90 100644 --- a/mate-panel/libpanel-util/panel-show.c +++ b/mate-panel/libpanel-util/panel-show.c @@ -177,11 +177,9 @@ gboolean panel_show_uri(GdkScreen* screen, const gchar* uri, guint32 timestamp, { return panel_show_caja_search_uri(screen, uri, timestamp, error); } -#if GTK_CHECK_VERSION (3, 22, 0) + gtk_show_uri_on_window (NULL, uri,timestamp, &local_error); -#else - gtk_show_uri(screen, uri, timestamp, &local_error); -#endif + return _panel_show_handle_error(uri, screen, local_error, error); } @@ -284,11 +282,8 @@ panel_show_help (GdkScreen *screen, uri = g_strdup_printf ("help:%s/%s", doc, link); else uri = g_strdup_printf ("help:%s", doc); -#if GTK_CHECK_VERSION (3, 22, 0) + gtk_show_uri_on_window (NULL, uri, gtk_get_current_event_time (), &local_error); -#else - gtk_show_uri (screen, uri, gtk_get_current_event_time (), &local_error); -#endif g_free (uri); return _panel_show_help_handle_error (doc, screen, local_error, error); diff --git a/mate-panel/menu.c b/mate-panel/menu.c index 6b2858f1..43695bb8 100644 --- a/mate-panel/menu.c +++ b/mate-panel/menu.c @@ -424,44 +424,15 @@ grab_widget (GtkWidget *widget) GdkWindow *window; GdkDisplay *display; -#if GTK_CHECK_VERSION (3, 20, 0) GdkSeat *seat; -#else - GdkDeviceManager *device_manager; - GdkDevice *pointer; - GdkDevice *keyboard; -#endif window = gtk_widget_get_window (widget); display = gdk_window_get_display (window); -#if GTK_CHECK_VERSION (3, 20, 0) seat = gdk_display_get_default_seat (display); gdk_seat_grab (seat, window, GDK_SEAT_CAPABILITY_ALL, TRUE, NULL, NULL, NULL, NULL); -#else - device_manager = gdk_display_get_device_manager (display); - pointer = gdk_device_manager_get_client_pointer (device_manager); - keyboard = gdk_device_get_associated_device (pointer); - - if (gdk_device_grab (pointer, window, - GDK_OWNERSHIP_WINDOW, TRUE, - GDK_SMOOTH_SCROLL_MASK | - GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | - GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK | - GDK_POINTER_MOTION_MASK, - NULL, GDK_CURRENT_TIME) != GDK_GRAB_SUCCESS) { - return; - } - - if (gdk_device_grab (keyboard, window, - GDK_OWNERSHIP_WINDOW, TRUE, - GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK, - NULL, GDK_CURRENT_TIME) != GDK_GRAB_SUCCESS) { - gdk_device_ungrab (pointer, GDK_CURRENT_TIME); - } -#endif } static void @@ -779,12 +750,8 @@ setup_menuitem (GtkWidget *menuitem, gtk_accel_label_set_accel_widget (GTK_ACCEL_LABEL (label), menuitem); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (label), 0.0); gtk_label_set_yalign (GTK_LABEL (label), 0.5); -#else - gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5); -#endif gtk_widget_show (label); gtk_container_add (GTK_CONTAINER (menuitem), label); diff --git a/mate-panel/panel-addto.c b/mate-panel/panel-addto.c index 825e1e67..49296882 100644 --- a/mate-panel/panel-addto.c +++ b/mate-panel/panel-addto.c @@ -1254,12 +1254,8 @@ panel_addto_dialog_new (PanelWidget *panel_widget) gtk_box_pack_start (GTK_BOX (inner_vbox), find_hbox, FALSE, FALSE, 0); dialog->label = gtk_label_new_with_mnemonic (""); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (dialog->label), 0.0); gtk_label_set_yalign (GTK_LABEL (dialog->label), 0.5); -#else - gtk_misc_set_alignment (GTK_MISC (dialog->label), 0.0, 0.5); -#endif gtk_label_set_use_markup (GTK_LABEL (dialog->label), TRUE); gtk_box_pack_start (GTK_BOX (find_hbox), dialog->label, diff --git a/mate-panel/panel-applet-frame.c b/mate-panel/panel-applet-frame.c index 933afc14..a78b8c88 100644 --- a/mate-panel/panel-applet-frame.c +++ b/mate-panel/panel-applet-frame.c @@ -123,11 +123,7 @@ mate_panel_applet_frame_draw (GtkWidget *widget, "background-image", &bg_pattern, NULL); -#if GTK_CHECK_VERSION (3, 18, 0) background = &frame->priv->panel->toplevel->background; -#else - background = &frame->priv->panel->background; -#endif if (bg_pattern && (background->type == PANEL_BACK_IMAGE || (background->type == PANEL_BACK_COLOR && background->has_alpha))) { cairo_matrix_t ptm; @@ -172,11 +168,8 @@ mate_panel_applet_frame_update_background_size (MatePanelAppletFrame *frame, old_allocation->width == new_allocation->width && old_allocation->height == new_allocation->height) return; -#if GTK_CHECK_VERSION (3, 18, 0) + background = &frame->priv->panel->toplevel->background; -#else - background = &frame->priv->panel->background; -#endif if (background->type == PANEL_BACK_NONE || (background->type == PANEL_BACK_COLOR && !background->has_alpha)) return; @@ -385,12 +378,7 @@ mate_panel_applet_frame_button_changed (GtkWidget *widget, MatePanelAppletFrame *frame; gboolean handled = FALSE; GdkDisplay *display; -#if GTK_CHECK_VERSION (3, 20, 0) GdkSeat *seat; -#else - GdkDevice *pointer; - GdkDeviceManager *device_manager; -#endif frame = MATE_PANEL_APPLET_FRAME (widget); @@ -419,16 +407,9 @@ mate_panel_applet_frame_button_changed (GtkWidget *widget, case 3: if (event->type == GDK_BUTTON_PRESS || event->type == GDK_2BUTTON_PRESS) { -#if GTK_CHECK_VERSION(3, 20, 0) display = gtk_widget_get_display (widget); seat = gdk_display_get_default_seat (display); gdk_seat_ungrab (seat); -#else - display = gtk_widget_get_display (widget); - device_manager = gdk_display_get_device_manager (display); - pointer = gdk_device_manager_get_client_pointer (device_manager); - gdk_device_ungrab (pointer, GDK_CURRENT_TIME); -#endif MATE_PANEL_APPLET_FRAME_GET_CLASS (frame)->popup_menu (frame, event->button, @@ -550,11 +531,7 @@ mate_panel_applet_frame_change_background (MatePanelAppletFrame *frame, if (frame->priv->has_handle) { PanelBackground *background; -#if GTK_CHECK_VERSION (3, 18, 0) background = &PANEL_WIDGET (parent)->toplevel->background; -#else - background = &PANEL_WIDGET (parent)->background; -#endif panel_background_apply_css (background, GTK_WIDGET (frame)); } @@ -645,11 +622,7 @@ _mate_panel_applet_frame_update_flags (MatePanelAppletFrame *frame, * it */ PanelBackground *background; -#if GTK_CHECK_VERSION (3, 18, 0) background = &frame->priv->panel->toplevel->background; -#else - background = &frame->priv->panel->background; -#endif mate_panel_applet_frame_change_background (frame, background->type); } } @@ -705,11 +678,8 @@ _mate_panel_applet_frame_get_background_string (MatePanelAppletFrame *frame, break; } } -#if GTK_CHECK_VERSION (3, 18, 0) + return panel_background_make_string (&panel->toplevel->background, x, y); -#else - return panel_background_make_string (&panel->background, x, y); -#endif } static void diff --git a/mate-panel/panel-ditem-editor.c b/mate-panel/panel-ditem-editor.c index 5d66ad65..77addfb8 100644 --- a/mate-panel/panel-ditem-editor.c +++ b/mate-panel/panel-ditem-editor.c @@ -503,12 +503,8 @@ label_new_with_mnemonic (const char *text) g_free (bold); gtk_label_set_use_markup (GTK_LABEL (label), TRUE); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (label), 1.0); gtk_label_set_yalign (GTK_LABEL (label), 0.5); -#else - gtk_misc_set_alignment (GTK_MISC (label), 1.0, 0.5); -#endif gtk_widget_show (label); diff --git a/mate-panel/panel-force-quit.c b/mate-panel/panel-force-quit.c index de8febce..fdd19438 100644 --- a/mate-panel/panel-force-quit.c +++ b/mate-panel/panel-force-quit.c @@ -105,13 +105,8 @@ remove_popup (GtkWidget *popup) { GdkWindow *root; GdkDisplay *display; -#if GTK_CHECK_VERSION (3, 20, 0) GdkSeat *seat; -#else - GdkDevice *pointer; - GdkDevice *keyboard; - GdkDeviceManager *device_manager; -#endif + root = gdk_screen_get_root_window ( gtk_window_get_screen (GTK_WINDOW (popup))); gdk_window_remove_filter (root, (GdkFilterFunc) popup_filter, popup); @@ -119,18 +114,9 @@ remove_popup (GtkWidget *popup) gtk_widget_destroy (popup); display = gdk_window_get_display (root); -#if GTK_CHECK_VERSION (3, 20, 0) seat = gdk_display_get_default_seat (display); gdk_seat_ungrab (seat); -#else - device_manager = gdk_display_get_device_manager (display); - pointer = gdk_device_manager_get_client_pointer (device_manager); - keyboard = gdk_device_get_associated_device (pointer); - - gdk_device_ungrab (pointer, GDK_CURRENT_TIME); - gdk_device_ungrab (keyboard, GDK_CURRENT_TIME); -#endif } static gboolean @@ -331,11 +317,7 @@ panel_force_quit (GdkScreen *screen, GdkDisplay *display; GdkDevice *pointer; GdkDevice *keyboard; -#if GTK_CHECK_VERSION (3, 20, 0) GdkSeat *seat; -#else - GdkDeviceManager *device_manager; -#endif popup = display_popup_window (screen); @@ -345,13 +327,8 @@ panel_force_quit (GdkScreen *screen, cross = gdk_cursor_new_for_display (gdk_display_get_default (), GDK_CROSS); display = gdk_window_get_display (root); -#if GTK_CHECK_VERSION (3, 20, 0) seat = gdk_display_get_default_seat (display); pointer = gdk_seat_get_pointer (seat); -#else - device_manager = gdk_display_get_device_manager (display); - pointer = gdk_device_manager_get_client_pointer (device_manager); -#endif keyboard = gdk_device_get_associated_device (pointer); status = gdk_device_grab (pointer, root, diff --git a/mate-panel/panel-frame.c b/mate-panel/panel-frame.c index ca395520..a99a810b 100644 --- a/mate-panel/panel-frame.c +++ b/mate-panel/panel-frame.c @@ -340,9 +340,8 @@ panel_frame_class_init (PanelFrameClass *klass) widget_class->get_preferred_width = panel_frame_get_preferred_width; widget_class->get_preferred_height = panel_frame_get_preferred_height; widget_class->draw = panel_frame_expose; -#if GTK_CHECK_VERSION (3, 20, 0) + gtk_widget_class_set_css_name (widget_class, "PanelFrame"); -#endif g_object_class_install_property ( gobject_class, diff --git a/mate-panel/panel-menu-bar.c b/mate-panel/panel-menu-bar.c index c8ffa76c..955e9c4b 100644 --- a/mate-panel/panel-menu-bar.c +++ b/mate-panel/panel-menu-bar.c @@ -270,11 +270,7 @@ static void panel_menu_bar_size_allocate(GtkWidget* widget, GtkAllocation* alloc return; } -#if GTK_CHECK_VERSION (3, 18, 0) background = &PANEL_MENU_BAR(widget)->priv->panel->toplevel->background; -#else - background = &PANEL_MENU_BAR(widget)->priv->panel->background; -#endif if (background->type == PANEL_BACK_NONE || (background->type == PANEL_BACK_COLOR && !background->has_alpha)) { return; @@ -434,11 +430,7 @@ void panel_menu_bar_popup_menu(PanelMenuBar* menubar, guint32 activate_time) void panel_menu_bar_change_background(PanelMenuBar* menubar) { -#if GTK_CHECK_VERSION (3, 18, 0) panel_background_apply_css(&menubar->priv->panel->toplevel->background, GTK_WIDGET(menubar)); -#else - panel_background_apply_css(&menubar->priv->panel->background, GTK_WIDGET(menubar)); -#endif } static void set_item_text_gravity(GtkWidget* item) @@ -468,12 +460,8 @@ static void set_item_text_angle_and_alignment(GtkWidget* item, double text_angle gtk_label_set_angle (GTK_LABEL (label), text_angle); -#if GTK_CHECK_VERSION (3, 16, 0) gtk_label_set_xalign (GTK_LABEL (label), xalign); gtk_label_set_yalign (GTK_LABEL (label), yalign); -#else - gtk_misc_set_alignment (GTK_MISC (label), xalign, yalign); -#endif } static void panel_menu_bar_update_orientation(PanelMenuBar* menubar) diff --git a/mate-panel/panel-multiscreen.c b/mate-panel/panel-multiscreen.c index d085413f..d2e43862 100644 --- a/mate-panel/panel-multiscreen.c +++ b/mate-panel/panel-multiscreen.c @@ -202,27 +202,17 @@ panel_multiscreen_get_gdk_monitors_for_screen (GdkScreen *screen, int *monitors_ret, GdkRectangle **geometries_ret) { -#if GTK_CHECK_VERSION (3, 22, 0) GdkDisplay *display; -#endif int num_monitors; GdkRectangle *geometries; int i; -#if GTK_CHECK_VERSION (3, 22, 0) display = gdk_screen_get_display (screen); num_monitors = gdk_display_get_n_monitors (display); -#else - num_monitors = gdk_screen_get_n_monitors (screen); -#endif geometries = g_new (GdkRectangle, num_monitors); for (i = 0; i < num_monitors; i++) -#if GTK_CHECK_VERSION (3, 22, 0) gdk_monitor_get_geometry (gdk_display_get_monitor (display, i), &(geometries[i])); -#else - gdk_screen_get_monitor_geometry (screen, i, &(geometries[i])); -#endif *monitors_ret = num_monitors; *geometries_ret = geometries; diff --git a/mate-panel/panel-profile.c b/mate-panel/panel-profile.c index 41e1dba6..15cf114e 100644 --- a/mate-panel/panel-profile.c +++ b/mate-panel/panel-profile.c @@ -534,11 +534,7 @@ panel_profile_load_background (PanelToplevel *toplevel) panel_widget = panel_toplevel_get_panel_widget (toplevel); -#if GTK_CHECK_VERSION (3, 18, 0) background = &panel_widget->toplevel->background; -#else - background = &panel_widget->background; -#endif background_type = panel_profile_get_background_type (toplevel); get_background_color (toplevel, &color); @@ -822,11 +818,8 @@ panel_profile_background_change_notify (GSettings *settings, if (panel_widget == NULL) return; -#if GTK_CHECK_VERSION (3, 18, 0) background = &panel_widget->toplevel->background; -#else - background = &panel_widget->background; -#endif + if (!strcmp (key, "type")) { PanelBackgroundType background_type; background_type = g_settings_get_enum (settings, key); diff --git a/mate-panel/panel-separator.c b/mate-panel/panel-separator.c index 5982196a..ce6e6454 100644 --- a/mate-panel/panel-separator.c +++ b/mate-panel/panel-separator.c @@ -154,11 +154,8 @@ panel_separator_size_allocate (GtkWidget *widget, old_allocation.width == allocation->width && old_allocation.height == allocation->height) return; -#if GTK_CHECK_VERSION (3, 18, 0) + background = &PANEL_SEPARATOR (widget)->priv->panel->toplevel->background; -#else - background = &PANEL_SEPARATOR (widget)->priv->panel->background; -#endif if (background->type == PANEL_BACK_NONE || (background->type == PANEL_BACK_COLOR && !background->has_alpha)) return; @@ -192,9 +189,7 @@ panel_separator_class_init (PanelSeparatorClass *klass) widget_class->size_allocate = panel_separator_size_allocate; widget_class->parent_set = panel_separator_parent_set; -#if GTK_CHECK_VERSION (3, 20, 0) gtk_widget_class_set_css_name (widget_class, "PanelSeparator"); -#endif g_type_class_add_private (klass, sizeof (PanelSeparator)); } @@ -279,9 +274,5 @@ panel_separator_create (PanelToplevel *toplevel, void panel_separator_change_background (PanelSeparator *separator) { -#if GTK_CHECK_VERSION (3, 18, 0) panel_background_apply_css(&separator->priv->panel->toplevel->background, GTK_WIDGET(separator)); -#else - panel_background_apply_css(&separator->priv->panel->background, GTK_WIDGET(separator)); -#endif } diff --git a/mate-panel/panel-toplevel.c b/mate-panel/panel-toplevel.c index 42b09d35..d6d8fda7 100644 --- a/mate-panel/panel-toplevel.c +++ b/mate-panel/panel-toplevel.c @@ -454,14 +454,8 @@ static void panel_toplevel_begin_grab_op(PanelToplevel* toplevel, PanelGrabOpTyp GdkCursorType cursor_type; GdkCursor *cursor; GdkDisplay *display; -#if GTK_CHECK_VERSION (3, 20, 0) GdkSeat *seat; GdkSeatCapabilities capabilities; -#else - GdkDevice *pointer; - GdkDevice *keyboard; - GdkDeviceManager *device_manager; -#endif if (toplevel->priv->state != PANEL_STATE_NORMAL || toplevel->priv->grab_op != PANEL_GRAB_OP_NONE) @@ -518,7 +512,6 @@ static void panel_toplevel_begin_grab_op(PanelToplevel* toplevel, PanelGrabOpTyp cursor = gdk_cursor_new_for_display (gdk_display_get_default (), cursor_type); display = gdk_window_get_display (window); -#if GTK_CHECK_VERSION(3, 20, 0) seat = gdk_display_get_default_seat (display); capabilities = GDK_SEAT_CAPABILITY_POINTER; if (grab_keyboard) @@ -528,37 +521,14 @@ static void panel_toplevel_begin_grab_op(PanelToplevel* toplevel, PanelGrabOpTyp NULL, NULL, NULL); g_object_unref (cursor); -#else - device_manager = gdk_display_get_device_manager (display); - pointer = gdk_device_manager_get_client_pointer (device_manager); - keyboard = gdk_device_get_associated_device (pointer); - - gdk_device_grab (pointer, window, - GDK_OWNERSHIP_NONE, FALSE, - GDK_POINTER_MOTION_MASK | GDK_BUTTON_RELEASE_MASK, - cursor, time_); - - g_object_unref (cursor); - - if (grab_keyboard) - gdk_device_grab (keyboard, window, - GDK_OWNERSHIP_NONE, FALSE, - GDK_KEY_PRESS | GDK_KEY_RELEASE, - NULL, time_); -#endif } static void panel_toplevel_end_grab_op (PanelToplevel* toplevel, guint32 time_) { GtkWidget *widget; GdkDisplay *display; -#if GTK_CHECK_VERSION (3, 20, 0) GdkSeat *seat; -#else - GdkDevice *pointer; - GdkDevice *keyboard; - GdkDeviceManager *device_manager; -#endif + g_return_if_fail (toplevel->priv->grab_op != PANEL_GRAB_OP_NONE); widget = GTK_WIDGET (toplevel); @@ -569,18 +539,9 @@ static void panel_toplevel_end_grab_op (PanelToplevel* toplevel, guint32 time_) gtk_grab_remove (widget); display = gtk_widget_get_display (widget); -#if GTK_CHECK_VERSION(3, 20, 0) seat = gdk_display_get_default_seat (display); gdk_seat_ungrab (seat); -#else - device_manager = gdk_display_get_device_manager (display); - pointer = gdk_device_manager_get_client_pointer (device_manager); - keyboard = gdk_device_get_associated_device (pointer); - - gdk_device_ungrab (pointer, time_); - gdk_device_ungrab (keyboard, time_); -#endif } static void panel_toplevel_cancel_grab_op(PanelToplevel* toplevel, guint32 time_) @@ -884,13 +845,8 @@ static gboolean panel_toplevel_warp_pointer_increment(PanelToplevel* toplevel, i screen = gtk_window_get_screen (GTK_WINDOW (toplevel)); root_window = gdk_screen_get_root_window (screen); -#if GTK_CHECK_VERSION(3, 20, 0) device = gdk_seat_get_pointer (gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET(root_window)))); gdk_window_get_device_position (gtk_widget_get_window (GTK_WIDGET (root_window)), device, &new_x, &new_y, NULL); -#else - device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gtk_widget_get_display (GTK_WIDGET(root_window)))); - gdk_window_get_device_position (gtk_widget_get_window (GTK_WIDGET (root_window)), device, &new_x, &new_y, NULL); -#endif switch (keyval) { case GDK_KEY_Up: @@ -1374,23 +1330,13 @@ static gboolean panel_toplevel_contains_pointer(PanelToplevel* toplevel) GdkDisplay *display; GdkScreen *screen; GtkWidget *widget; -#if GTK_CHECK_VERSION(3, 20, 0) GdkSeat *seat; GdkDevice *pointer; -#else - GdkDeviceManager *device_manager; - GdkDevice *pointer; -#endif int x, y; display = gdk_display_get_default (); -#if GTK_CHECK_VERSION(3, 20, 0) seat = gdk_display_get_default_seat (display); pointer = gdk_seat_get_pointer (seat); -#else - device_manager = gdk_display_get_device_manager (display); - pointer = gdk_device_manager_get_client_pointer (device_manager); -#endif widget = GTK_WIDGET (toplevel); if (!gtk_widget_get_realized (widget)) @@ -2247,11 +2193,8 @@ panel_toplevel_update_position (PanelToplevel *toplevel) * x = 1 => outer bevel => x = 0 => no outer bevel = > x = 1 => ... * FIXME: maybe the real bug is that we enter into this loop (see bug * #160748 to learn how to reproduce.) */ -#if GTK_CHECK_VERSION (3, 18, 0) background = &toplevel->background; -#else - background = &toplevel->priv->panel_widget->background; -#endif + /* There's no bevels with a color/image background */ if (panel_background_effective_type (background) == PANEL_BACK_NONE) { GtkStyleContext *context; @@ -2301,10 +2244,6 @@ calculate_minimum_height (GtkWidget *widget, GtkBorder padding; PangoContext *pango_context; PangoFontMetrics *metrics; -#if !GTK_CHECK_VERSION (3, 20, 0) - int focus_width = 0; - int focus_pad = 0; -#endif int ascent; int descent; int thickness; @@ -2324,22 +2263,11 @@ calculate_minimum_height (GtkWidget *widget, pango_font_metrics_unref (metrics); -#if !GTK_CHECK_VERSION (3, 20, 0) - gtk_widget_style_get (widget, - "focus-line-width", &focus_width, - "focus-padding", &focus_pad, - NULL); -#endif - thickness = orientation & PANEL_HORIZONTAL_MASK ? padding.top + padding.bottom : padding.left + padding.right; -#if GTK_CHECK_VERSION (3, 20, 0) return PANGO_PIXELS (ascent + descent) + thickness; -#else - return PANGO_PIXELS (ascent + descent) + 2 * (focus_width + focus_pad) + thickness; -#endif } static int @@ -2995,7 +2923,6 @@ panel_toplevel_initially_hide (PanelToplevel *toplevel) toplevel->priv->initial_animation_done = TRUE; } -#if GTK_CHECK_VERSION (3, 18, 0) static void set_background_default_style (GtkWidget *widget) { @@ -3027,12 +2954,10 @@ set_background_default_style (GtkWidget *widget) if (bg_image) cairo_pattern_destroy (bg_image); } -#endif static void panel_toplevel_realize (GtkWidget *widget) { -#if GTK_CHECK_VERSION (3, 18, 0) PanelToplevel *toplevel; GdkScreen *screen; GdkVisual *visual; @@ -3048,25 +2973,16 @@ panel_toplevel_realize (GtkWidget *widget) gtk_widget_set_visual (widget, visual); gtk_window_stick (GTK_WINDOW (widget)); -#else - PanelToplevel *toplevel = (PanelToplevel *) widget; - GdkWindow *window; -#endif gtk_window_set_decorated (GTK_WINDOW (widget), FALSE); gtk_window_stick (GTK_WINDOW (widget)); gtk_window_set_type_hint (GTK_WINDOW (widget), GDK_WINDOW_TYPE_HINT_DOCK); -#if GTK_CHECK_VERSION (3, 18, 0) GTK_WIDGET_CLASS (panel_toplevel_parent_class)->realize (widget); -#else - if (GTK_WIDGET_CLASS (panel_toplevel_parent_class)->realize) - GTK_WIDGET_CLASS (panel_toplevel_parent_class)->realize (widget); -#endif + window = gtk_widget_get_window (widget); -#if GTK_CHECK_VERSION (3, 18, 0) set_background_default_style (widget); panel_background_realized (&toplevel->background, window); -#endif + panel_struts_set_window_hint (toplevel); gdk_window_set_group (window, window); @@ -3096,18 +3012,11 @@ panel_toplevel_disconnect_timeouts (PanelToplevel *toplevel) static void panel_toplevel_unrealize (GtkWidget *widget) { -#if GTK_CHECK_VERSION (3, 18, 0) PanelToplevel *toplevel; toplevel = PANEL_TOPLEVEL (widget); panel_toplevel_disconnect_timeouts (toplevel); panel_background_unrealized (&toplevel->background); GTK_WIDGET_CLASS (panel_toplevel_parent_class)->unrealize (widget); -#else - panel_toplevel_disconnect_timeouts (PANEL_TOPLEVEL (widget)); - - if (GTK_WIDGET_CLASS (panel_toplevel_parent_class)->unrealize) - GTK_WIDGET_CLASS (panel_toplevel_parent_class)->unrealize (widget); -#endif } static void @@ -3215,7 +3124,6 @@ panel_toplevel_get_preferred_height (GtkWidget *widget, *minimum_height = *natural_height = req.height; } -#if GTK_CHECK_VERSION (3, 18, 0) static void set_background_region (PanelToplevel *toplevel) { @@ -3246,7 +3154,6 @@ set_background_region (PanelToplevel *toplevel) origin_x, origin_y, allocation.width, allocation.height); } -#endif static void panel_toplevel_size_allocate (GtkWidget *widget, @@ -3321,9 +3228,7 @@ panel_toplevel_size_allocate (GtkWidget *widget, if (child && gtk_widget_get_visible (child)) gtk_widget_size_allocate (child, &challoc); -#if GTK_CHECK_VERSION (3, 18, 0) set_background_region (toplevel); -#endif } static gboolean panel_toplevel_draw(GtkWidget* widget, cairo_t* cr) @@ -3483,7 +3388,7 @@ panel_toplevel_button_release_event (GtkWidget *widget, return TRUE; } -#if GTK_CHECK_VERSION (3, 18, 0) + static gboolean panel_toplevel_configure_event (GtkWidget *widget, GdkEventConfigure *event) @@ -3496,7 +3401,6 @@ panel_toplevel_configure_event (GtkWidget *widget, return TRUE; } -#endif static gboolean panel_toplevel_key_press_event (GtkWidget *widget, @@ -3514,7 +3418,6 @@ panel_toplevel_key_press_event (GtkWidget *widget, return FALSE; } -#if GTK_CHECK_VERSION (3, 18, 0) static void panel_toplevel_state_flags_changed (GtkWidget *widget, GtkStateFlags previous_state) @@ -3524,7 +3427,6 @@ panel_toplevel_state_flags_changed (GtkWidget *widget, set_background_default_style (widget); } -#endif static gboolean panel_toplevel_motion_notify_event (GtkWidget *widget, @@ -4011,9 +3913,7 @@ panel_toplevel_style_updated (GtkWidget *widget) if (GTK_WIDGET_CLASS (panel_toplevel_parent_class)->style_updated) GTK_WIDGET_CLASS (panel_toplevel_parent_class)->style_updated (widget); -#if GTK_CHECK_VERSION (3, 18, 0) set_background_default_style (widget); -#endif } static void @@ -4283,9 +4183,8 @@ panel_toplevel_finalize (GObject *object) G_CALLBACK (panel_toplevel_drag_threshold_changed), toplevel); toplevel->priv->gtk_settings = NULL; -#if GTK_CHECK_VERSION (3, 18, 0) + panel_background_free (&toplevel->background); -#endif } if (toplevel->priv->attached) { @@ -4327,9 +4226,7 @@ panel_toplevel_class_init (PanelToplevelClass *klass) widget_class->realize = panel_toplevel_realize; widget_class->unrealize = panel_toplevel_unrealize; -#if GTK_CHECK_VERSION (3, 18, 0) widget_class->state_flags_changed = panel_toplevel_state_flags_changed; -#endif widget_class->draw = panel_toplevel_draw; widget_class->get_preferred_width = panel_toplevel_get_preferred_width; widget_class->get_preferred_height = panel_toplevel_get_preferred_height; @@ -4337,9 +4234,7 @@ panel_toplevel_class_init (PanelToplevelClass *klass) widget_class->size_allocate = panel_toplevel_size_allocate; widget_class->button_press_event = panel_toplevel_button_press_event; widget_class->button_release_event = panel_toplevel_button_release_event; -#if GTK_CHECK_VERSION (3, 18, 0) widget_class->configure_event = panel_toplevel_configure_event; -#endif widget_class->key_press_event = panel_toplevel_key_press_event; widget_class->motion_notify_event = panel_toplevel_motion_notify_event; widget_class->enter_notify_event = panel_toplevel_enter_notify_event; @@ -4348,9 +4243,7 @@ panel_toplevel_class_init (PanelToplevelClass *klass) widget_class->focus_in_event = panel_toplevel_focus_in_event; widget_class->focus_out_event = panel_toplevel_focus_out_event; -#if GTK_CHECK_VERSION (3, 20, 0) gtk_widget_class_set_css_name (widget_class, "PanelToplevel"); -#endif container_class->check_resize = panel_toplevel_check_resize; @@ -4750,7 +4643,6 @@ panel_toplevel_setup_widgets (PanelToplevel *toplevel) gtk_widget_show (toplevel->priv->grid); } -#if GTK_CHECK_VERSION (3, 18, 0) static void background_changed (PanelBackground *background, PanelToplevel *toplevel) @@ -4758,14 +4650,11 @@ background_changed (PanelBackground *background, panel_toplevel_update_edges (toplevel); panel_widget_emit_background_changed (toplevel->priv->panel_widget); } -#endif static void panel_toplevel_init (PanelToplevel *toplevel) { -#if GTK_CHECK_VERSION (3, 18, 0) GtkWidget *widget; -#endif int i; toplevel->priv = PANEL_TOPLEVEL_GET_PRIVATE (toplevel); @@ -4849,20 +4738,16 @@ panel_toplevel_init (PanelToplevel *toplevel) toplevel->priv->updated_geometry_initial = FALSE; toplevel->priv->initial_animation_done = FALSE; -#if GTK_CHECK_VERSION (3, 18, 0) widget = GTK_WIDGET (toplevel); gtk_widget_add_events (widget, -#else - gtk_widget_add_events (GTK_WIDGET (toplevel), -#endif GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_POINTER_MOTION_MASK | GDK_ENTER_NOTIFY_MASK | GDK_LEAVE_NOTIFY_MASK); -#if GTK_CHECK_VERSION (3, 18, 0) + gtk_widget_set_app_paintable (widget, TRUE); -#endif + panel_toplevel_setup_widgets (toplevel); panel_toplevel_update_description (toplevel); panel_toplevel_update_gtk_settings (toplevel); @@ -4874,11 +4759,10 @@ panel_toplevel_init (PanelToplevel *toplevel) */ g_signal_connect(GTK_WIDGET(toplevel), "delete-event", G_CALLBACK(gtk_true), NULL); -#if GTK_CHECK_VERSION (3, 18, 0) panel_background_init (&toplevel->background, (PanelBackgroundChangedNotify) background_changed, toplevel); -#endif + /*ensure the panel BG can always be themed*/ /*Without this gtk3.19/20 cannot set the BG color and resetting the bg to system is not immediately applied*/ GtkStyleContext *context; diff --git a/mate-panel/panel-toplevel.h b/mate-panel/panel-toplevel.h index 51bc0059..206397da 100644 --- a/mate-panel/panel-toplevel.h +++ b/mate-panel/panel-toplevel.h @@ -28,10 +28,7 @@ #include <gtk/gtk.h> #include "panel-background.h" - -#if GTK_CHECK_VERSION (3, 18, 0) #include "panel-enums.h" -#endif #ifdef __cplusplus extern "C" { @@ -60,9 +57,7 @@ struct _PanelToplevel { GSettings *settings; GSettings *queued_settings; GSettings *background_settings; -#if GTK_CHECK_VERSION (3, 18, 0) PanelBackground background; -#endif PanelToplevelPrivate *priv; }; diff --git a/mate-panel/panel-widget.c b/mate-panel/panel-widget.c index ce9d88b0..a11e4432 100644 --- a/mate-panel/panel-widget.c +++ b/mate-panel/panel-widget.c @@ -78,16 +78,6 @@ static void panel_widget_cremove (GtkContainer *container, static void panel_widget_dispose (GObject *obj); static void panel_widget_finalize (GObject *obj); -#if !GTK_CHECK_VERSION (3, 18, 0) -static void panel_widget_realize (GtkWidget *widget); -static void panel_widget_unrealize (GtkWidget *panel); -static void panel_widget_state_flags_changed (GtkWidget *widget, - GtkStateFlags previous_state); -static void panel_widget_style_updated (GtkWidget *widget); -static void panel_widget_background_changed (PanelBackground *background, - PanelWidget *panel); -#endif - static void panel_widget_push_move_applet (PanelWidget *panel, GtkDirectionType dir); static void panel_widget_switch_move_applet (PanelWidget *panel, @@ -424,15 +414,8 @@ panel_widget_class_init (PanelWidgetClass *class) widget_class->get_preferred_width = panel_widget_get_preferred_width; widget_class->get_preferred_height = panel_widget_get_preferred_height; widget_class->size_allocate = panel_widget_size_allocate; -#if GTK_CHECK_VERSION (3, 20, 0) + gtk_widget_class_set_css_name (widget_class, "PanelWidget"); -#endif -#if !GTK_CHECK_VERSION (3, 18, 0) - widget_class->realize = panel_widget_realize; - widget_class->unrealize = panel_widget_unrealize; - widget_class->state_flags_changed = panel_widget_state_flags_changed; - widget_class->style_updated = panel_widget_style_updated; -#endif widget_class->focus = panel_widget_real_focus; container_class->add = panel_widget_cadd; @@ -1371,30 +1354,7 @@ queue_resize_on_all_applets(PanelWidget *panel) gtk_widget_queue_resize (ad->applet); } } -#if !GTK_CHECK_VERSION(3, 18, 0) -static void -panel_widget_set_background_region (PanelWidget *panel) -{ - GtkWidget *widget; - int origin_x = -1, origin_y = -1; - GtkAllocation allocation; - widget = GTK_WIDGET (panel); - - if (!gtk_widget_get_realized (widget)) - return; - - gdk_window_get_origin (gtk_widget_get_window (widget), &origin_x, &origin_y); - - gtk_widget_get_allocation (widget, &allocation); - - panel_background_change_region ( - &panel->background, panel->orient, - origin_x, origin_y, - allocation.width, - allocation.height); -} -#endif static void panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation) { @@ -1587,9 +1547,6 @@ panel_widget_size_allocate(GtkWidget *widget, GtkAllocation *allocation) } } -#if !GTK_CHECK_VERSION(3, 18, 0) - panel_widget_set_background_region (panel); -#endif gtk_widget_queue_resize(widget); } @@ -1611,13 +1568,8 @@ panel_widget_is_cursor(PanelWidget *panel, int overlap) !gtk_widget_get_visible(widget)) return FALSE; -#if GTK_CHECK_VERSION(3, 20, 0) device = gdk_seat_get_pointer (gdk_display_get_default_seat (gtk_widget_get_display (widget))); gdk_window_get_device_position(gtk_widget_get_window (widget), device, &x, &y, NULL); -#else - device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gtk_widget_get_display (widget))); - gdk_window_get_device_position(gtk_widget_get_window (widget), device, &x, &y, NULL); -#endif gtk_widget_get_allocation (widget, &allocation); w = allocation.width; @@ -1631,94 +1583,6 @@ panel_widget_is_cursor(PanelWidget *panel, int overlap) return FALSE; } -#if !GTK_CHECK_VERSION (3, 18, 0) -static void -panel_widget_set_background_default_style (GtkWidget *widget) -{ - GtkStyleContext *context; - GtkStateFlags state; - GdkRGBA *bg_color; - cairo_pattern_t *bg_image; - PanelBackground *background; - - if (gtk_widget_get_realized (widget)) { - context = gtk_widget_get_style_context (widget); - state = gtk_widget_get_state_flags (widget); - background = &PANEL_WIDGET (widget)->background; - panel_background_apply_css (&PANEL_WIDGET (widget)->background, widget); - gtk_style_context_add_class(context,"gnome-panel-menu-bar"); - gtk_style_context_add_class(context,"mate-panel-menu-bar"); - - gtk_style_context_get (context, state, - "background-color", &bg_color, - "background-image", &bg_image, - NULL); - - panel_background_set_default_style (background, - bg_color, - bg_image); - - if (bg_image) - cairo_pattern_destroy (bg_image); - } -} - -static void -panel_widget_state_flags_changed (GtkWidget *widget, GtkStateFlags previous_state) -{ - panel_widget_set_background_default_style (widget); -} - -static void -panel_widget_style_updated (GtkWidget *widget) -{ - GTK_WIDGET_CLASS (panel_widget_parent_class)->style_updated (widget); - panel_widget_set_background_default_style (widget); -} - -static gboolean -toplevel_configure_event (GtkWidget *widget, - GdkEventConfigure *event, - PanelWidget *panel) -{ - panel_widget_set_background_region (panel); - return FALSE; -} - -static void -panel_widget_realize (GtkWidget *widget) -{ - PanelWidget *panel = (PanelWidget *) widget; - GdkWindow *window; - - g_signal_connect (panel->toplevel, "configure-event", - G_CALLBACK (toplevel_configure_event), panel); - - GTK_WIDGET_CLASS (panel_widget_parent_class)->realize (widget); - - window = gtk_widget_get_window (widget); - - panel_widget_set_background_default_style (widget); - - panel_background_realized (&panel->background, window); -} - -static void -panel_widget_unrealize (GtkWidget *widget) -{ - PanelWidget *panel = (PanelWidget *) widget; - - panel_background_unrealized (&panel->background); - - g_signal_handlers_disconnect_by_func ( - panel->toplevel, - G_CALLBACK (toplevel_configure_event), - panel); - - GTK_WIDGET_CLASS (panel_widget_parent_class)->unrealize (widget); -} -#endif - static void panel_widget_finalize (GObject *obj) { @@ -1727,9 +1591,7 @@ panel_widget_finalize (GObject *obj) g_return_if_fail (PANEL_IS_WIDGET (obj)); panel = PANEL_WIDGET (obj); -#if !GTK_CHECK_VERSION(3, 18, 0) - panel_background_free (&panel->background); -#endif + if (panel->applets_hints != NULL) g_free (panel->applets_hints); panel->applets_hints = NULL; @@ -1813,11 +1675,7 @@ panel_widget_init (PanelWidget *panel) panel->nb_applets_size_hints = 0; panel->applets_hints = NULL; panel->applets_using_hint = NULL; -#if !GTK_CHECK_VERSION(3, 18, 0) - panel_background_init (&panel->background, - (PanelBackgroundChangedNotify) panel_widget_background_changed, - panel); -#endif + panels = g_slist_append (panels, panel); } @@ -1948,29 +1806,16 @@ panel_widget_applet_drag_start (PanelWidget *panel, GdkGrabStatus status; GdkCursor *fleur_cursor; GdkDisplay *display; -#if GTK_CHECK_VERSION(3, 20, 0) GdkSeat *seat; -#else - GdkDevice *pointer; - GdkDeviceManager *device_manager; -#endif + fleur_cursor = gdk_cursor_new_for_display (gdk_display_get_default (), GDK_FLEUR); display = gdk_window_get_display (window); -#if GTK_CHECK_VERSION(3, 20, 0) seat = gdk_display_get_default_seat (display); status = gdk_seat_grab (seat, window, GDK_SEAT_CAPABILITY_POINTER, FALSE, fleur_cursor, NULL, NULL, NULL); -#else - device_manager = gdk_display_get_device_manager (display); - pointer = gdk_device_manager_get_client_pointer (device_manager); - status = gdk_device_grab (pointer, window, - GDK_OWNERSHIP_NONE, FALSE, - APPLET_EVENT_MASK, - fleur_cursor, time_); -#endif g_object_unref (fleur_cursor); gdk_flush (); @@ -1986,31 +1831,19 @@ panel_widget_applet_drag_start (PanelWidget *panel, void panel_widget_applet_drag_end (PanelWidget *panel) { -#if GTK_CHECK_VERSION(3, 20, 0) GdkDisplay *display; GdkSeat *seat; -#else - GdkDisplay *display; - GdkDevice *pointer; - GdkDeviceManager *device_manager; -#endif g_return_if_fail (PANEL_IS_WIDGET (panel)); if (panel->currently_dragged_applet == NULL) return; -#if GTK_CHECK_VERSION(3, 20, 0) + display = gtk_widget_get_display (GTK_WIDGET (panel)); seat = gdk_display_get_default_seat (display); gdk_seat_ungrab (seat); -#else - display = gtk_widget_get_display (GTK_WIDGET (panel)); - device_manager = gdk_display_get_device_manager (display); - pointer = gdk_device_manager_get_client_pointer (device_manager); - gdk_device_ungrab (pointer, GDK_CURRENT_TIME); -#endif gtk_grab_remove (panel->currently_dragged_applet->applet); panel_widget_applet_drag_end_no_grab (panel); panel_toplevel_pop_autohide_disabler (panel->toplevel); @@ -2027,13 +1860,8 @@ panel_widget_get_cursorloc (PanelWidget *panel) g_return_val_if_fail (PANEL_IS_WIDGET (panel), -1); -#if GTK_CHECK_VERSION (3, 20, 0) device = gdk_seat_get_pointer (gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET(panel)))); gdk_window_get_device_position(gtk_widget_get_window (GTK_WIDGET(panel)), device, &x, &y, NULL); -#else - device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gtk_widget_get_display (GTK_WIDGET(panel)))); - gdk_window_get_device_position(gtk_widget_get_window (GTK_WIDGET(panel)), device, &x, &y, NULL); -#endif rtl = gtk_widget_get_direction (GTK_WIDGET (panel)) == GTK_TEXT_DIR_RTL; if (panel->orient == GTK_ORIENTATION_HORIZONTAL) @@ -2256,13 +2084,8 @@ panel_widget_applet_move_to_cursor (PanelWidget *panel) } } -#if GTK_CHECK_VERSION (3, 20, 0) device = gdk_seat_get_pointer (gdk_display_get_default_seat (gtk_widget_get_display (GTK_WIDGET (panel)))); gdk_window_get_device_position (gtk_widget_get_window (GTK_WIDGET(panel)), device, NULL, NULL, &mods); -#else - device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gtk_widget_get_display (GTK_WIDGET (panel)))); - gdk_window_get_device_position (gtk_widget_get_window (GTK_WIDGET(panel)), device, NULL, NULL, &mods); -#endif movement = PANEL_SWITCH_MOVE; @@ -2316,13 +2139,8 @@ move_timeout_handler(gpointer data) widget = panel->currently_dragged_applet->applet; -#if GTK_CHECK_VERSION (3, 20, 0) device = gdk_seat_get_pointer (gdk_display_get_default_seat (gtk_widget_get_display (widget))); gdk_window_get_device_position (gtk_widget_get_window (widget), device, &x, &y, NULL); -#else - device = gdk_device_manager_get_client_pointer (gdk_display_get_device_manager (gtk_widget_get_display (widget))); - gdk_window_get_device_position(gtk_widget_get_window (widget), device, &x, &y, NULL); -#endif gtk_widget_get_allocation (widget, &allocation); w = allocation.width; @@ -2823,24 +2641,11 @@ panel_widget_set_size (PanelWidget *panel_widget, gtk_widget_queue_resize (GTK_WIDGET (panel_widget)); } -#if GTK_CHECK_VERSION (3, 18, 0) void panel_widget_emit_background_changed (PanelWidget *panel) { g_signal_emit (panel, panel_widget_signals [BACK_CHANGE_SIGNAL], 0); } -#else -static void -panel_widget_background_changed (PanelBackground *background, - PanelWidget *panel) -{ - g_return_if_fail (PANEL_IS_WIDGET (panel)); - panel_toplevel_update_edges (panel->toplevel); - g_signal_emit (G_OBJECT (panel), - panel_widget_signals [BACK_CHANGE_SIGNAL], - 0); -} -#endif static void panel_widget_push_move_applet (PanelWidget *panel, diff --git a/mate-panel/panel-widget.h b/mate-panel/panel-widget.h index e9064085..e84cc6c2 100644 --- a/mate-panel/panel-widget.h +++ b/mate-panel/panel-widget.h @@ -206,9 +206,7 @@ void panel_widget_focus (PanelWidget *panel); PanelOrientation panel_widget_get_applet_orientation (PanelWidget *panel); -#if GTK_CHECK_VERSION (3, 18, 0) void panel_widget_emit_background_changed (PanelWidget *panel); -#endif void panel_widget_set_applet_size_constrained (PanelWidget *panel, GtkWidget *applet, diff --git a/mate-panel/panel.c b/mate-panel/panel.c index 8b4401f2..aa129e4b 100644 --- a/mate-panel/panel.c +++ b/mate-panel/panel.c @@ -157,12 +157,7 @@ back_change (AppletInfo *info, switch (info->type) { case PANEL_OBJECT_APPLET: mate_panel_applet_frame_change_background ( - -#if GTK_CHECK_VERSION (3, 18, 0) MATE_PANEL_APPLET_FRAME (info->widget), panel->toplevel->background.type); -#else - MATE_PANEL_APPLET_FRAME (info->widget), panel->background.type); -#endif break; case PANEL_OBJECT_MENU_BAR: panel_menu_bar_change_background (PANEL_MENU_BAR (info->widget)); diff --git a/mate-panel/xstuff.c b/mate-panel/xstuff.c index 20f1dfe9..7db48acf 100644 --- a/mate-panel/xstuff.c +++ b/mate-panel/xstuff.c @@ -335,12 +335,8 @@ xstuff_zoom_animate (GtkWidget *widget, GdkScreen *gscreen; GdkRectangle rect, dest; GtkAllocation allocation; -#if GTK_CHECK_VERSION (3, 22, 0) GdkMonitor *monitor; GdkDisplay *display; -#else - int monitor; -#endif if (opt_rect) rect = *opt_rect; @@ -363,16 +359,10 @@ xstuff_zoom_animate (GtkWidget *widget, rect.width, rect.height, pixbuf, orientation); else { -#if GTK_CHECK_VERSION (3, 22, 0) display = gdk_screen_get_display (gscreen); monitor = gdk_display_get_monitor_at_window (display, gtk_widget_get_window (widget)); gdk_monitor_get_geometry (monitor, &dest); -#else - monitor = gdk_screen_get_monitor_at_window (gscreen, - gtk_widget_get_window (widget)); - gdk_screen_get_monitor_geometry (gscreen, monitor, &dest); -#endif draw_zoom_animation (gscreen, rect.x, rect.y, rect.width, rect.height, |