From dbdcf8fb917fcb8d1923c35fdccf30274a2fb603 Mon Sep 17 00:00:00 2001 From: Vadim Zeitlin Date: Fri, 23 Sep 2022 00:51:56 +0200 Subject: [PATCH] Avoid deprecation warnings for gdk_threads_enter/leave() Use wrapper functions just to avoid the warnings for them, as we want to keep calling them for compatibility, even if the functions are deprecated in GTK since a very long time. --- include/wx/gtk/private/threads.h | 14 ++++++++++++++ src/gtk/app.cpp | 1 + 2 files changed, 15 insertions(+) diff --git a/include/wx/gtk/private/threads.h b/include/wx/gtk/private/threads.h index e944d8fd8f..d89ea04e8a 100644 --- a/include/wx/gtk/private/threads.h +++ b/include/wx/gtk/private/threads.h @@ -10,6 +10,20 @@ #ifndef _WX_GTK_PRIVATE_THREADS_H_ #define _WX_GTK_PRIVATE_THREADS_H_ +// ---------------------------------------------------------------------------- +// Redefine GDK functions to avoiding deprecation warnings +// ---------------------------------------------------------------------------- + +wxGCC_WARNING_SUPPRESS(deprecated-declarations) + +static inline void wx_gdk_threads_enter() { gdk_threads_enter(); } +#define gdk_threads_enter wx_gdk_threads_enter + +static inline void wx_gdk_threads_leave() { gdk_threads_leave(); } +#define gdk_threads_leave wx_gdk_threads_leave + +wxGCC_WARNING_RESTORE(deprecated-declarations) + // ---------------------------------------------------------------------------- // RAII wrapper for acquiring/leaving GDK lock in ctor/dtor // ---------------------------------------------------------------------------- diff --git a/src/gtk/app.cpp b/src/gtk/app.cpp index 31c6c5905b..c7ffd2b3f3 100644 --- a/src/gtk/app.cpp +++ b/src/gtk/app.cpp @@ -31,6 +31,7 @@ #include "wx/gtk/private.h" #include "wx/gtk/private/log.h" +#include "wx/gtk/private/threads.h" #include "wx/gtk/mimetype.h" //-----------------------------------------------------------------------------