From eed121741ae9127dac854e865210e733b008c7e9 Mon Sep 17 00:00:00 2001 From: monsta Date: Wed, 23 Nov 2016 22:25:19 +0300 Subject: move to GTK+3 (>= 3.14), drop GTK+2 code and --with-gtk build option and require mate-panel >= 1.17 --- configure.ac | 35 +++-------------- mate-window-picker-applet/applet.c | 16 -------- mate-window-picker-applet/task-item.c | 37 +----------------- mate-window-picker-applet/task-title.c | 68 ---------------------------------- maximus/main.c | 4 -- maximus/maximus-app.c | 4 -- maximus/tomboykeybinder.c | 4 -- 7 files changed, 7 insertions(+), 161 deletions(-) diff --git a/configure.ac b/configure.ac index 987e6a2..da1cc80 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ AC_PREREQ(2.53) -AC_INIT(mate-netbook, 1.16.1, []) +AC_INIT(mate-netbook, 1.17.0, []) AM_INIT_AUTOMAKE([1.9 foreign tar-ustar no-dist-gzip dist-xz check-news]) m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])]) AC_CONFIG_SRCDIR(maximus/main.c) @@ -38,30 +38,11 @@ AC_SUBST(GCC_FLAGS) GLIB_REQUIRED=2.36.0 -AC_MSG_CHECKING([which gtk+ version to compile against]) -AC_ARG_WITH([gtk], - [AS_HELP_STRING([--with-gtk=2.0|3.0],[which gtk+ version to compile against (default: 2.0)])], - [case "$with_gtk" in - 2.0|3.0) ;; - *) AC_MSG_ERROR([invalid gtk version specified]) ;; - esac], - [with_gtk=2.0]) -AC_MSG_RESULT([$with_gtk]) - -case "$with_gtk" in - 2.0) GTK_API_VERSION=2.0 - LIBWNCK_API_VERSION=1.0 - ;; - 3.0) GTK_API_VERSION=3.0 - LIBWNCK_API_VERSION=3.0 - ;; -esac - PKG_CHECK_MODULES(MAXIMUS_DEPS, - gtk+-$GTK_API_VERSION + gtk+-3.0 glib-2.0 >= $GLIB_REQUIRED gio-2.0 - libwnck-$LIBWNCK_API_VERSION + libwnck-3.0 xtst libfakekey ) @@ -69,11 +50,11 @@ AC_SUBST(MAXIMUS_DEPS_CFLAGS) AC_SUBST(MAXIMUS_DEPS_LIBS) PKG_CHECK_MODULES(MATEWINDOWPICKER_DEPS, - libmatepanelapplet-4.0 - gtk+-$GTK_API_VERSION + libmatepanelapplet-4.0 >= 1.17.0 + gtk+-3.0 glib-2.0 >= $GLIB_REQUIRED gio-2.0 - libwnck-$LIBWNCK_API_VERSION + libwnck-3.0 ) AC_SUBST(MATEWINDOWPICKER_DEPS_CFLAGS) AC_SUBST(MATEWINDOWPICKER_DEPS_LIBS) @@ -88,7 +69,3 @@ mate-window-picker-applet/Makefile mate-window-picker-applet/org.mate.panel.applet.mate-window-picker-applet.gschema.xml po/Makefile.in ]) - -echo " - GTK+ API version: ${GTK_API_VERSION} -" diff --git a/mate-window-picker-applet/applet.c b/mate-window-picker-applet/applet.c index e3f3129..9629f9b 100644 --- a/mate-window-picker-applet/applet.c +++ b/mate-window-picker-applet/applet.c @@ -159,11 +159,7 @@ cw_applet_fill (MatePanelApplet *applet, force_no_focus_padding (GTK_WIDGET (applet)); gtk_container_set_border_width (GTK_CONTAINER (applet), 0); -#if GTK_CHECK_VERSION (3, 0, 0) eb = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 6); -#else - eb = gtk_hbox_new (FALSE, 6); -#endif gtk_container_add (GTK_CONTAINER (applet), eb); gtk_container_set_border_width (GTK_CONTAINER (eb), 0); @@ -251,22 +247,14 @@ display_prefs_dialog (GtkAction *action, GDK_WINDOW_TYPE_HINT_DIALOG); gtk_container_set_border_width (GTK_CONTAINER (window), 12); -#if GTK_CHECK_VERSION (3, 0, 0) box = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); -#else - box = gtk_vbox_new (FALSE, 8); -#endif gtk_container_add (GTK_CONTAINER (window), box); nb = gtk_notebook_new (); g_object_set (nb, "show-tabs", FALSE, "show-border", TRUE, NULL); gtk_box_pack_start (GTK_BOX (box), nb, TRUE, TRUE, 0); -#if GTK_CHECK_VERSION (3, 0, 0) vbox = gtk_box_new (GTK_ORIENTATION_VERTICAL, 8); -#else - vbox = gtk_vbox_new (FALSE, 8); -#endif gtk_container_set_border_width (GTK_CONTAINER (vbox), 8); gtk_notebook_append_page (GTK_NOTEBOOK (nb), vbox, NULL); @@ -282,11 +270,7 @@ display_prefs_dialog (GtkAction *action, gtk_widget_set_size_request (nb, -1, 100); -#if GTK_CHECK_VERSION (3, 0, 0) hbox = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 0); -#else - hbox = gtk_hbox_new (FALSE, 0); -#endif gtk_box_pack_start (GTK_BOX (box), hbox, TRUE, TRUE, 0); label = gtk_label_new (" "); diff --git a/mate-window-picker-applet/task-item.c b/mate-window-picker-applet/task-item.c index e9d0085..1eca186 100644 --- a/mate-window-picker-applet/task-item.c +++ b/mate-window-picker-applet/task-item.c @@ -96,10 +96,7 @@ update_hints (TaskItem *item) { x1 = y1 = 0; gdkwindow = gtk_widget_get_window (parent); -#if !GTK_CHECK_VERSION (3, 0, 0) - if (GDK_IS_WINDOW (gdkwindow)) -#endif - gdk_window_get_origin (gdkwindow, &x1, &y1); + gdk_window_get_origin (gdkwindow, &x1, &y1); x += x1; y += y1; break; } @@ -202,8 +199,6 @@ task_item_set_visibility (TaskItem *item) } } -#if GTK_CHECK_VERSION (3, 0, 0) - static void task_item_get_preferred_width (GtkWidget *widget, gint *minimal_width, @@ -220,19 +215,6 @@ task_item_get_preferred_height (GtkWidget *widget, *minimal_height = *natural_height = DEFAULT_TASK_ITEM_HEIGHT; } -#else - -static void -task_item_size_request (GtkWidget *widget, - GtkRequisition *requisition) -{ - /* Candidate for terrible hack of the year award */ - requisition->width = DEFAULT_TASK_ITEM_WIDTH; - requisition->height = DEFAULT_TASK_ITEM_HEIGHT; -} - -#endif - static GdkPixbuf * task_item_sized_pixbuf_for_window (TaskItem *item, WnckWindow *window, @@ -280,13 +262,8 @@ task_item_sized_pixbuf_for_window (TaskItem *item, return pbuf; } static gboolean -#if GTK_CHECK_VERSION (3, 0, 0) task_item_draw (GtkWidget *widget, cairo_t *unused) -#else -task_item_expose_event (GtkWidget *widget, - GdkEventExpose *event) -#endif { cairo_t *cr; TaskItem *item; @@ -296,9 +273,6 @@ task_item_expose_event (GtkWidget *widget, g_return_val_if_fail (widget != NULL, FALSE); g_return_val_if_fail (TASK_IS_ITEM (widget), FALSE); -#if !GTK_CHECK_VERSION (3, 0, 0) - g_return_val_if_fail (event != NULL, FALSE); -#endif item = TASK_ITEM (widget); priv = item->priv; @@ -306,11 +280,7 @@ task_item_expose_event (GtkWidget *widget, g_return_val_if_fail (WNCK_IS_WINDOW (priv->window), FALSE); area = priv->area; -#if GTK_CHECK_VERSION (3, 0, 0) cr = gdk_cairo_create (gtk_widget_get_window (widget)); -#else - cr = gdk_cairo_create (event->window); -#endif pbuf = priv->pixbuf; @@ -743,14 +713,9 @@ task_item_class_init (TaskItemClass *klass) GtkWidgetClass *widget_class = GTK_WIDGET_CLASS (klass); obj_class->finalize = task_item_finalize; -#if GTK_CHECK_VERSION (3, 0, 0) widget_class->draw = task_item_draw; widget_class->get_preferred_width = task_item_get_preferred_width; widget_class->get_preferred_height = task_item_get_preferred_height; -#else - widget_class->expose_event = task_item_expose_event; - widget_class->size_request = task_item_size_request; -#endif g_type_class_add_private (obj_class, sizeof (TaskItemPrivate)); diff --git a/mate-window-picker-applet/task-title.c b/mate-window-picker-applet/task-title.c index bcc594f..8e52532 100644 --- a/mate-window-picker-applet/task-title.c +++ b/mate-window-picker-applet/task-title.c @@ -107,7 +107,6 @@ on_leave_notify (GtkWidget *widget, return FALSE; } -#if GTK_CHECK_VERSION (3, 0, 0) static gboolean on_button_draw (GtkWidget *widget, cairo_t *cr, @@ -142,36 +141,6 @@ on_button_draw (GtkWidget *widget, } return FALSE; } -#else -static gboolean -on_button_expose (GtkWidget *widget, - GdkEventExpose *event, - TaskTitle *title) -{ - g_return_val_if_fail (TASK_IS_TITLE (title), FALSE); - - TaskTitlePrivate *priv; - priv = title->priv; - - if (priv->mouse_in_close_button) - { - GtkStyle *style = gtk_widget_get_style (widget); - - gtk_paint_box (style, - event->window, - GTK_STATE_PRELIGHT, - GTK_SHADOW_NONE, - NULL, - NULL, - NULL, - event->area.x, - event->area.y + 2, - event->area.width, - event->area.height - 4); - } - return FALSE; -} -#endif static void on_name_changed (WnckWindow *window, TaskTitle *title) @@ -389,8 +358,6 @@ on_button_release (GtkWidget *title, GdkEventButton *event) return FALSE; } - -#if GTK_CHECK_VERSION (3, 0, 0) static gboolean on_draw (GtkWidget *w, cairo_t *cr) { @@ -408,24 +375,6 @@ on_draw (GtkWidget *w, cairo_t *cr) cr); return TRUE; } -#else -static gboolean -on_expose (GtkWidget *w, GdkEventExpose *event) -{ - if (w->state == GTK_STATE_ACTIVE) { - gtk_paint_box (w->style, w->window, - w->state, GTK_SHADOW_NONE, - NULL, w, "button", - w->allocation.x, w->allocation.y, - w->allocation.width, w->allocation.height); - } - - gtk_container_propagate_expose (GTK_CONTAINER (w), - gtk_bin_get_child (GTK_BIN (w)), - event); - return TRUE; -} -#endif /* GObject stuff */ static void @@ -448,11 +397,7 @@ task_title_class_init (TaskTitleClass *klass) GtkWidgetClass *wid_class = GTK_WIDGET_CLASS (klass); obj_class->finalize = task_title_finalize; -#if GTK_CHECK_VERSION (3, 0, 0) wid_class->draw = on_draw; -#else - wid_class->expose_event = on_expose; -#endif g_type_class_add_private (obj_class, sizeof (TaskTitlePrivate)); } @@ -483,23 +428,15 @@ task_title_init (TaskTitle *title) 0, 0, 6, 6); gtk_container_add (GTK_CONTAINER (title), priv->align); -#if GTK_CHECK_VERSION (3, 0, 0) priv->box = gtk_box_new (GTK_ORIENTATION_HORIZONTAL, 2); -#else - priv->box = gtk_hbox_new (FALSE, 2); -#endif gtk_container_add (GTK_CONTAINER (priv->align), priv->box); gtk_widget_set_no_show_all (priv->box, TRUE); gtk_widget_show (priv->box); priv->label = gtk_label_new (_("Home")); gtk_label_set_ellipsize (GTK_LABEL (priv->label), PANGO_ELLIPSIZE_END); -#if GTK_CHECK_VERSION (3, 0, 0) gtk_widget_set_halign (priv->label, GTK_ALIGN_START); gtk_widget_set_valign (priv->label, GTK_ALIGN_CENTER); -#else - gtk_misc_set_alignment (GTK_MISC (priv->label), 0.0, 0.5); -#endif PangoAttrList *attr_list = pango_attr_list_new (); PangoAttribute *attr = pango_attr_weight_new (PANGO_WEIGHT_BOLD); @@ -527,13 +464,8 @@ task_title_init (TaskTitle *title) G_CALLBACK (on_enter_notify), title); g_signal_connect (priv->button, "leave-notify-event", G_CALLBACK (on_leave_notify), title); -#if GTK_CHECK_VERSION (3, 0, 0) g_signal_connect (priv->button, "draw", G_CALLBACK (on_button_draw), title); -#else - g_signal_connect (priv->button, "expose-event", - G_CALLBACK (on_button_expose), title); -#endif gdkscreen = gtk_widget_get_screen (GTK_WIDGET (title)); theme = gtk_icon_theme_get_for_screen (gdkscreen); diff --git a/maximus/main.c b/maximus/main.c index 644ceca..b271cd2 100644 --- a/maximus/main.c +++ b/maximus/main.c @@ -91,11 +91,7 @@ gint main (gint argc, gchar *argv[]) gdk_error_trap_push (); app = maximus_app_get_default (); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_error_trap_pop_ignored (); -#else - gdk_error_trap_pop (); -#endif gtk_main (); diff --git a/maximus/maximus-app.c b/maximus/maximus-app.c index f6ee627..a08278b 100644 --- a/maximus/maximus-app.c +++ b/maximus/maximus-app.c @@ -481,11 +481,7 @@ on_app_undecorate_changed (GSettings *settings, wnck_window_unmaximize (window); wnck_window_maximize (window); gdk_flush (); -#if GTK_CHECK_VERSION (3, 0, 0) gdk_error_trap_pop_ignored (); -#else - gdk_error_trap_pop (); -#endif sleep (1); } diff --git a/maximus/tomboykeybinder.c b/maximus/tomboykeybinder.c index e84a586..8607082 100644 --- a/maximus/tomboykeybinder.c +++ b/maximus/tomboykeybinder.c @@ -309,11 +309,7 @@ tomboy_keybinder_is_modifier (guint keycode) XModifierKeymap *mod_keymap; gboolean retval = FALSE; -#if GTK_CHECK_VERSION (3, 0, 0) mod_keymap = XGetModifierMapping (GDK_DISPLAY_XDISPLAY (gdk_display_get_default ())); -#else - mod_keymap = XGetModifierMapping (gdk_display); -#endif map_size = 8 * mod_keymap->max_keypermod; -- cgit v1.2.1