From ba9203959ae76f3a457364885b596793d826cb82 Mon Sep 17 00:00:00 2001 From: eidheim Date: Mon, 8 May 2023 16:59:32 +0200 Subject: [PATCH] Cleanup of GTK_VERSION_GT_MICRO replacement macro --- src/selection_dialog.cpp | 2 +- src/selection_dialog.hpp | 6 ++++++ src/tooltips.cpp | 2 +- src/utility.hpp | 6 ------ 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/selection_dialog.cpp b/src/selection_dialog.cpp index 397a10a..9385f88 100644 --- a/src/selection_dialog.cpp +++ b/src/selection_dialog.cpp @@ -139,7 +139,7 @@ SelectionDialogBase::SelectionDialogBase(Source::BaseView *view_, const boost::o } SelectionDialogBase::~SelectionDialogBase() { -#if defined(__APPLE__) && GTK_VERSION_GT_MICRO2(3, 24, 34) +#if defined(__APPLE__) && GTK_VERSION_GT_MICRO_CORRECTED(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/selection_dialog.hpp b/src/selection_dialog.hpp index 6b7bb0b..3bbe7b6 100644 --- a/src/selection_dialog.hpp +++ b/src/selection_dialog.hpp @@ -5,6 +5,12 @@ #include #include +// GTK_VERSION_GT_MICRO has a typo (in gtkmm/base.h) +#define GTK_VERSION_GT_MICRO_CORRECTED(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 SelectionDialogBase { class ListViewText : public Gtk::TreeView { class ColumnRecord : public Gtk::TreeModel::ColumnRecord { diff --git a/src/tooltips.cpp b/src/tooltips.cpp index 2ed2bb7..edaebbf 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_MICRO2(3, 24, 34) +#if defined(__APPLE__) && GTK_VERSION_GT_MICRO_CORRECTED(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 5b7a4a4..1f4e1d9 100644 --- a/src/utility.hpp +++ b/src/utility.hpp @@ -3,12 +3,6 @@ #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;