From b2ea6171452581b3b670c5c61d84458bf64e6393 Mon Sep 17 00:00:00 2001 From: Paul Cornett Date: Sun, 17 Dec 2017 21:51:36 -0800 Subject: [PATCH] Avoid deprecated gtk_text_iter_begins_tag() --- include/wx/gtk/private/gtk3-compat.h | 20 +++++++++++++++++--- src/gtk/textctrl.cpp | 3 ++- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/include/wx/gtk/private/gtk3-compat.h b/include/wx/gtk/private/gtk3-compat.h index 2aa415d544..19e9626b15 100644 --- a/include/wx/gtk/private/gtk3-compat.h +++ b/include/wx/gtk/private/gtk3-compat.h @@ -10,10 +10,23 @@ #ifndef _WX_GTK_PRIVATE_COMPAT3_H_ #define _WX_GTK_PRIVATE_COMPAT3_H_ -#if defined(__WXGTK3__) - wxGCC_WARNING_SUPPRESS(deprecated-declarations) +#ifndef __WXGTK4__ + +// ---------------------------------------------------------------------------- +// the following were introduced in GTK+ 3.20 + +static inline gboolean wx_gtk_text_iter_starts_tag(const GtkTextIter* iter, GtkTextTag* tag) +{ + return gtk_text_iter_begins_tag(iter, tag); +} +#define gtk_text_iter_starts_tag wx_gtk_text_iter_starts_tag + +#endif // !__WXGTK4__ + +#ifdef __WXGTK3__ + // ---------------------------------------------------------------------------- // the following were introduced in GTK+ 3.12 @@ -29,7 +42,8 @@ static inline void wx_gtk_widget_set_margin_end(GtkWidget* widget, gint margin) } #define gtk_widget_set_margin_end wx_gtk_widget_set_margin_end +#endif // __WXGTK3__ + wxGCC_WARNING_RESTORE() -#endif // __WXGTK3__ #endif // _WX_GTK_PRIVATE_COMPAT3_H_ diff --git a/src/gtk/textctrl.cpp b/src/gtk/textctrl.cpp index d12d13b42c..32e6ec5834 100644 --- a/src/gtk/textctrl.cpp +++ b/src/gtk/textctrl.cpp @@ -32,6 +32,7 @@ #include #include "wx/gtk/private.h" #include "wx/gtk/private/gtk2-compat.h" +#include "wx/gtk/private/gtk3-compat.h" // ---------------------------------------------------------------------------- // helpers @@ -2006,7 +2007,7 @@ void wxTextCtrl::OnUrlMouseEvent(wxMouseEvent& event) SetCursor(wxCursor(wxCURSOR_HAND)); start = end; - if(!gtk_text_iter_begins_tag(&start, tag)) + if (!gtk_text_iter_starts_tag(&start, tag)) gtk_text_iter_backward_to_tag_toggle(&start, tag); if(!gtk_text_iter_ends_tag(&end, tag)) gtk_text_iter_forward_to_tag_toggle(&end, tag);