From 7e15a8a3980ca82e89d5f95b8ddd1792bf828f0c Mon Sep 17 00:00:00 2001 From: eidheim Date: Thu, 4 May 2023 16:14:22 +0200 Subject: [PATCH] Fixed GTK_VERSION_GT_MICRO check --- src/selection_dialog.cpp | 3 ++- src/tooltips.cpp | 2 +- src/utility.hpp | 6 ++++++ 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/src/selection_dialog.cpp b/src/selection_dialog.cpp index 7e4f6bb..397a10a 100644 --- a/src/selection_dialog.cpp +++ b/src/selection_dialog.cpp @@ -1,4 +1,5 @@ #include "selection_dialog.hpp" +#include "utility.hpp" #include SelectionDialogBase::ListViewText::ListViewText(bool use_markup) : Gtk::TreeView(), use_markup(use_markup) { @@ -138,7 +139,7 @@ SelectionDialogBase::SelectionDialogBase(Source::BaseView *view_, const boost::o } SelectionDialogBase::~SelectionDialogBase() { -#if defined(__APPLE__) && GTK_VERSION_GT_MICRO(3, 24, 34) +#if defined(__APPLE__) && GTK_VERSION_GT_MICRO2(3, 24, 34) // Workaround for https://gitlab.gnome.org/GNOME/gtk/-/issues/5593 by keeping window alive slightly longer window.close(); Glib::signal_timeout().connect([window = std::make_shared(std::move(window))] { return false; }, 5000); diff --git a/src/tooltips.cpp b/src/tooltips.cpp index b62335a..2ed2bb7 100644 --- a/src/tooltips.cpp +++ b/src/tooltips.cpp @@ -19,7 +19,7 @@ Tooltip::Tooltip(std::function set_buffer_) : view(nullptr), set_buffer(std::move(set_buffer_)) {} Tooltip::~Tooltip() { -#if defined(__APPLE__) && GTK_VERSION_GT_MICRO(3, 24, 34) +#if defined(__APPLE__) && GTK_VERSION_GT_MICRO2(3, 24, 34) // Workaround for https://gitlab.gnome.org/GNOME/gtk/-/issues/5593 by keeping window alive slightly longer if(window) { window->close(); diff --git a/src/utility.hpp b/src/utility.hpp index 1f4e1d9..5b7a4a4 100644 --- a/src/utility.hpp +++ b/src/utility.hpp @@ -3,6 +3,12 @@ #include #include +// GTK_VERSION_GT_MICRO has a typo (in gtkmm/base.h) +#define GTK_VERSION_GT_MICRO2(major, minor, micro) \ + ((GTK_MAJOR_VERSION > major) || \ + (GTK_MAJOR_VERSION == major) && (GTK_MINOR_VERSION > minor) || \ + (GTK_MAJOR_VERSION == major) && (GTK_MINOR_VERSION == minor) && (GTK_MICRO_VERSION > micro)) + class ScopeGuard { public: std::function on_exit;