[geany/geany] d065c5: Initial pass at remove GTK+2

Matthew Brush git-noreply at xxxxx
Sat May 29 12:20:45 UTC 2021


Branch:      refs/heads/master
Author:      Matthew Brush <matt at geany.org>
Committer:   Matthew Brush <matt at geany.org>
Date:        Sun, 04 Oct 2020 12:31:01 UTC
Commit:      d065c5098508f660d5f8ac16700d1c5a3e4e653c
             https://github.com/geany/geany/commit/d065c5098508f660d5f8ac16700d1c5a3e4e653c

Log Message:
-----------
Initial pass at remove GTK+2

Updating the build system and some of the conditional code.
More to come.


Modified Paths:
--------------
    HACKING
    README
    configure.ac
    data/Makefile.am
    src/gtkcompat.h
    src/plugindata.h
    src/stash.c

Modified: HACKING
3 lines changed, 0 insertions(+), 3 deletions(-)
===================================================================
@@ -791,9 +791,6 @@ Building Plugins
 The geany-plugins autotools script automatically detects the
 installed system Geany and builds the plugins against that.
 
-Plugins will build with either GTK2 or GTK3, whichever the detected
-Geany was built with.
-
 To use plugins with a development version of Geany built with
 a different prefix, the plugins will need to be compiled against
 that version if the ABI has changed.


Modified: README
8 lines changed, 4 insertions(+), 4 deletions(-)
===================================================================
@@ -49,10 +49,10 @@ Installation from sources
 
 Requirements
 ++++++++++++
-For compiling Geany yourself, you will need the GTK2 (>= 2.24) or
-GTK3 libraries and header files. You will also need its dependency libraries
-and header files, such as Pango, Glib and ATK. All these files are
-available at https://www.gtk.org.
+For compiling Geany yourself, you will need the GTK3 libraries and 
+header files. You will also need its dependency libraries and header 
+files, such as Pango, Glib and ATK. All these files are available at 
+https://www.gtk.org.
 
 Furthermore you need, of course, a C compiler and the Make tool; a C++
 compiler is also needed for the required Scintilla library included. The


Modified: configure.ac
29 lines changed, 4 insertions(+), 25 deletions(-)
===================================================================
@@ -71,38 +71,17 @@ AC_CHECK_DECLS([_NSGetEnviron],,,[[#include <crt_externs.h>]])
 GEANY_CHECK_REVISION([dnl force debug mode for a VCS working copy
 					  CFLAGS="-g -DGEANY_DEBUG $CFLAGS"])
 
-# GTK version check
-AC_ARG_ENABLE([gtk2],
-		[AS_HELP_STRING([--enable-gtk2],
-						[compile against deprecated GTK2 [default=no]])],
-		[enable_gtk2=$enableval],
-		[enable_gtk2=no])
-
-gtk2_package=gtk+-2.0
-gtk2_min_version=2.24
-gtk3_package=gtk+-3.0
-gtk3_min_version=3.0
-
-AS_IF([test "x$enable_gtk2" = "xyes"],
-	[gtk_package=$gtk2_package
-	 gtk_min_version=$gtk2_min_version],
-	[gtk_package=$gtk3_package
-	 gtk_min_version=$gtk3_min_version])
-
-AM_CONDITIONAL([GTK3], [test "x$gtk_package" = "x$gtk3_package"])
-
 # GTK/GLib/GIO checks
-gtk_modules="$gtk_package >= $gtk_min_version glib-2.0 >= 2.32"
+gtk_modules="gtk+-3.0 >= 3.0 glib-2.0 >= 2.32"
 gtk_modules_private="gio-2.0 >= 2.32 gmodule-no-export-2.0"
 PKG_CHECK_MODULES([GTK], [$gtk_modules $gtk_modules_private])
 AC_SUBST([DEPENDENCIES], [$gtk_modules])
 AS_VAR_APPEND([GTK_CFLAGS], [" -DGLIB_VERSION_MIN_REQUIRED=GLIB_VERSION_2_32"])
-dnl Disable all GTK deprecations on 3.x so long as we want to keep 2.x support and only require 3.0.
-dnl No need on 2.x as we target the latest version.
-AM_COND_IF([GTK3], [AS_VAR_APPEND([GTK_CFLAGS], [" -DGDK_DISABLE_DEPRECATION_WARNINGS"])])
+dnl Disable all GTK deprecations
+AS_VAR_APPEND([GTK_CFLAGS], [" -DGDK_DISABLE_DEPRECATION_WARNINGS"])
 AC_SUBST([GTK_CFLAGS])
 AC_SUBST([GTK_LIBS])
-GTK_VERSION=`$PKG_CONFIG --modversion $gtk_package`
+GTK_VERSION=`$PKG_CONFIG --modversion gtk+-3.0`
 AC_SUBST([GTK_VERSION])
 GEANY_STATUS_ADD([Using GTK version], [${GTK_VERSION}])
 # GTHREAD checks


Modified: data/Makefile.am
5 lines changed, 0 insertions(+), 5 deletions(-)
===================================================================
@@ -119,12 +119,7 @@ nobase_dist_pkgdata_DATA = \
 	ui_toolbar.xml \
 	geany.glade
 
-if GTK3
 nobase_dist_pkgdata_DATA += \
 	geany-3.0.css \
 	geany-3.20.css \
 	geany.css
-else
-nobase_dist_pkgdata_DATA += geany.gtkrc
-endif
-


Modified: src/gtkcompat.h
81 lines changed, 5 insertions(+), 76 deletions(-)
===================================================================
@@ -18,86 +18,15 @@
  *      51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
  */
 
-/* Compatibility macros to support older GTK+ versions */
+/* Compatibility macros to support older GTK+ versions
+ * 
+ * TODO: This file can be removed once the code is updated to use GTK3 keysyms.
+ */
 
 #ifndef GTK_COMPAT_H
 #define GTK_COMPAT_H 1
 
 #include <gtk/gtk.h>
-#if GTK_CHECK_VERSION(3, 0, 0)
-#	include <gdk/gdkkeysyms-compat.h>
-#endif
-
-G_BEGIN_DECLS
-
-
-/* GtkComboBoxText */
-/* This is actually available in GTK 2.24, but we expose GtkComboBoxText in the
- * API so we don't want the type to change for no good reason (although this
- * should probably be harmless since it's only a derivated type).  However, since
- * a plugin needs to be rebuilt and tuned to work with GTK3 we don't mind that
- * a type changes between the GTK2 and GTK3 version */
-#if ! GTK_CHECK_VERSION(3, 0, 0)
-/* undef those not to get warnings about redefinitions under GTK 2.24 */
-#	undef GTK_COMBO_BOX_TEXT
-#	undef GTK_COMBO_BOX_TEXT_CLASS
-#	undef GTK_COMBO_BOX_TEXT_GET_CLASS
-#	undef GTK_IS_COMBO_BOX_TEXT
-#	undef GTK_IS_COMBO_BOX_TEXT_CLASS
-#	undef GTK_TYPE_COMBO_BOX_TEXT
-
-#	define GTK_COMBO_BOX_TEXT					GTK_COMBO_BOX
-#	define GTK_COMBO_BOX_TEXT_CLASS				GTK_COMBO_BOX_CLASS
-#	define GTK_COMBO_BOX_TEXT_GET_CLASS			GTK_COMBO_BOX_GET_CLASS
-#	define GTK_IS_COMBO_BOX_TEXT				GTK_IS_COMBO_BOX
-#	define GTK_IS_COMBO_BOX_TEXT_CLASS			GTK_IS_COMBO_BOX_CLASS
-#	define GTK_TYPE_COMBO_BOX_TEXT				GTK_TYPE_COMBO_BOX
-#	define GtkComboBoxText						GtkComboBox
-#	define gtk_combo_box_text_new				gtk_combo_box_new_text
-#	define gtk_combo_box_text_new_with_entry	gtk_combo_box_entry_new_text
-#	define gtk_combo_box_text_append_text		gtk_combo_box_append_text
-#	define gtk_combo_box_text_insert_text		gtk_combo_box_insert_text
-#	define gtk_combo_box_text_prepend_text		gtk_combo_box_prepend_text
-#	define gtk_combo_box_text_remove			gtk_combo_box_remove_text
-#	define gtk_combo_box_text_get_active_text	gtk_combo_box_get_active_text
-#endif
-
-/* GtkWidget */
-#if ! GTK_CHECK_VERSION(3, 0, 0)
-#	define gtk_widget_get_allocated_height(widget)	(((GtkWidget *) (widget))->allocation.height)
-#	define gtk_widget_get_allocated_width(widget)	(((GtkWidget *) (widget))->allocation.width)
-#endif
-
-
-/* Mappings below only prevent some deprecation warnings on GTK3 for things
- * that didn't exist on GTK2.  That's not future-proof. */
-#if GTK_CHECK_VERSION(3, 0, 0)
-/* Gtk[VH]Box */
-#	define compat_gtk_box_new(orientation, homogeneous, spacing) \
-		((GtkWidget *)g_object_new(GTK_TYPE_BOX, \
-					 "orientation", (orientation), \
-					 "homogeneous", (homogeneous), \
-					 "spacing", (spacing), \
-					 NULL))
-#	define gtk_vbox_new(homogeneous, spacing) \
-		compat_gtk_box_new(GTK_ORIENTATION_VERTICAL, (homogeneous), (spacing))
-#	define gtk_hbox_new(homogeneous, spacing) \
-		compat_gtk_box_new(GTK_ORIENTATION_HORIZONTAL, (homogeneous), (spacing))
-/* Gtk[VH]ButtonBox */
-#	define gtk_vbutton_box_new()	gtk_button_box_new(GTK_ORIENTATION_VERTICAL)
-#	define gtk_hbutton_box_new()	gtk_button_box_new(GTK_ORIENTATION_HORIZONTAL)
-/* Gtk[VH]Separator */
-#	define gtk_vseparator_new()	gtk_separator_new(GTK_ORIENTATION_VERTICAL)
-#	define gtk_hseparator_new()	gtk_separator_new(GTK_ORIENTATION_HORIZONTAL)
-/* Gtk[VH]Paned */
-#	define gtk_vpaned_new()	gtk_paned_new(GTK_ORIENTATION_VERTICAL)
-#	define gtk_hpaned_new()	gtk_paned_new(GTK_ORIENTATION_HORIZONTAL)
-/* Gtk[VH]Scrollbar */
-#	define gtk_vscrollbar_new(adj)	gtk_scrollbar_new(GTK_ORIENTATION_VERTICAL, (adj))
-#	define gtk_hscrollbar_new(adj)	gtk_scrollbar_new(GTK_ORIENTATION_HORIZONTAL, (adj))
-#endif
-
-
-G_END_DECLS
+#include <gdk/gdkkeysyms-compat.h>
 
 #endif /* GTK_COMPAT_H */


Modified: src/plugindata.h
11 lines changed, 4 insertions(+), 7 deletions(-)
===================================================================
@@ -60,13 +60,10 @@ G_BEGIN_DECLS
  */
 #define GEANY_API_VERSION 239
 
-/* hack to have a different ABI when built with GTK3 because loading GTK2-linked plugins
- * with GTK3-linked Geany leads to crash */
-#if GTK_CHECK_VERSION(3, 0, 0)
-#	define GEANY_ABI_SHIFT 8
-#else
-#	define GEANY_ABI_SHIFT 0
-#endif
+
+/* when gtk2 and gtk3 were both supported at the same time this was used
+ * to prevent loading gtk2 plugins with gtk3 Geany or vice versa. */
+#define GEANY_ABI_SHIFT 8
 /** The Application Binary Interface (ABI) version, incremented whenever
  * existing fields in the plugin data types have to be changed or reordered.
  * Changing this forces all plugins to be recompiled before Geany can load them. */


Modified: src/stash.c
10 lines changed, 3 insertions(+), 7 deletions(-)
===================================================================
@@ -83,12 +83,9 @@
 #include <stdlib.h> /* only for atoi() */
 
 
-/* GTK3 removed ComboBoxEntry, but we need a value to differentiate combo box with and
- * without entries, and it must not collide with other GTypes */
-#ifdef GTK_TYPE_COMBO_BOX_ENTRY
-#	define TYPE_COMBO_BOX_ENTRY GTK_TYPE_COMBO_BOX_ENTRY
-#else /* !GTK_TYPE_COMBO_BOX_ENTRY */
-#	define TYPE_COMBO_BOX_ENTRY get_combo_box_entry_type()
+#define TYPE_COMBO_BOX_ENTRY get_combo_box_entry_type()
+
+
 static GType get_combo_box_entry_type(void)
 {
 	static volatile gsize type = 0;
@@ -100,7 +97,6 @@ static GType get_combo_box_entry_type(void)
 	}
 	return type;
 }
-#endif /* !GTK_TYPE_COMBO_BOX_ENTRY */
 
 
 struct StashPref



--------------
This E-Mail was brought to you by github_commit_mail.py (Source: https://github.com/geany/infrastructure).


More information about the Commits mailing list