Avoid gtk2 deprecation warnings

This commit is contained in:
Kim Woelders 2023-12-06 19:13:44 +01:00
parent f613023c74
commit deec303250
5 changed files with 14 additions and 23 deletions

View File

@ -24,20 +24,15 @@ AC_ARG_WITH(gtk,
[ --with-gtk Select GTK version to use (auto/gtk2/gtk3) @<:@default=auto@:>@],,
with_gtk=auto)
test_gtk="$with_gtk"
if test "x$with_gtk" = "xauto" ; then test_gtk="gtk2"; fi
if test "x$test_gtk" = "xgtk2" ; then
if test "x$with_gtk" = "xauto" -o "x$with_gtk" = "xgtk2"; then
AC_MSG_CHECKING([for GTK2]);
pkg_modules="gtk+-2.0 >= 2.0.0"
PKG_CHECK_MODULES(GTK, [$pkg_modules],,
[if test "x$with_gtk" = "xauto" ; then test_gtk="gtk3"; fi])
PKG_CHECK_MODULES(GTK, [gtk+-2.0 >= 2.0.0], with_gtk="gtk2"
AC_DEFINE(USE_GTK, 2, [Using GTK 2]), no="y")
fi
if test "x$test_gtk" = "xgtk3" ; then
if test "x$with_gtk" = "xauto" -o "x$with_gtk" = "xgtk3"; then
AC_MSG_CHECKING([for GTK3]);
pkg_modules="gtk+-3.0 >= 3.0.0"
PKG_CHECK_MODULES(GTK, [$pkg_modules])
PKG_CHECK_MODULES(GTK, [gtk+-3.0 >= 3.0.0], with_gtk="gtk3"
AC_DEFINE(USE_GTK, 3, [Using GTK 3]), no="y")
fi
if test "x$GTK_CFLAGS" = "x" ; then
AC_MSG_ERROR([GTK 2 or 3 is required.])

View File

@ -7,16 +7,19 @@
#define __UNUSED__
#endif
#if GTK_CHECK_VERSION(3,0,0)
#define USE_GTK 3
#pragma GCC diagnostic push
#if USE_GTK == 2
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
#pragma GCC diagnostic ignored "-Wstrict-prototypes"
#endif
#include <gtk/gtk.h>
#pragma GCC diagnostic pop
#if USE_GTK == 3
#define gtk_hbox_new(homogeneous, spacing) \
gtk_box_new(GTK_ORIENTATION_HORIZONTAL, spacing)
#define gtk_vbox_new(homogeneous, spacing) \
gtk_box_new(GTK_ORIENTATION_VERTICAL, spacing)
#else
#define USE_GTK 2
#endif
/* ipc.c */

2
ipc.c
View File

@ -1,7 +1,5 @@
#include "config.h"
#include <gtk/gtk.h>
#include <gdk/gdk.h>
#include <gdk/gdkx.h>
#include <X11/Xlib.h>
#include <stdio.h>

View File

@ -5,9 +5,6 @@
#include <sys/stat.h>
#include <unistd.h>
#include <gdk/gdkkeysyms.h>
#include <gtk/gtk.h>
#include "e16keyedit.h"
GtkWidget *

View File

@ -5,8 +5,6 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <gdk/gdkx.h>
#include <gtk/gtk.h>
#include "e16keyedit.h"