From 60287fbf7ea37e31e5c3b4be38339dd6dff3739d Mon Sep 17 00:00:00 2001 From: sheaf Date: Wed, 23 Oct 2024 14:49:22 +0200 Subject: [PATCH] Require GTK >= 4.10 --- MetaBrush.cabal | 16 ++-------------- src/app/MetaBrush/Asset/Colours.hs | 10 +--------- src/app/MetaBrush/GTK/Util.hs | 15 --------------- 3 files changed, 3 insertions(+), 38 deletions(-) diff --git a/MetaBrush.cabal b/MetaBrush.cabal index 422b518..c28a064 100644 --- a/MetaBrush.cabal +++ b/MetaBrush.cabal @@ -29,13 +29,6 @@ flag asserts default: False manual: True --- Workaround for https://github.com/haskell/cabal/issues/4237 --- See https://github.com/commercialhaskell/stack/issues/2197 -flag gtk-410 - description: GTK is 4.10 or later - default: True - manual: False - common common build-depends: @@ -165,13 +158,8 @@ common gtk , haskell-gi-base >= 0.26.8 && < 0.27 - -- Workaround for https://github.com/haskell/cabal/issues/4237 - -- See https://github.com/commercialhaskell/stack/issues/2197 - if flag(gtk-410) - pkgconfig-depends: gtk4 >= 4.10 - cpp-options: -DMIN_VERSION_GTK_4_10 - else - pkgconfig-depends: gtk4 < 4.10 + pkgconfig-depends: + gtk4 >= 4.10 library metabrushes diff --git a/src/app/MetaBrush/Asset/Colours.hs b/src/app/MetaBrush/Asset/Colours.hs index bf0669f..d919a23 100644 --- a/src/app/MetaBrush/Asset/Colours.hs +++ b/src/app/MetaBrush/Asset/Colours.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# OPTIONS_GHC -fno-warn-deprecations #-} @@ -94,12 +93,5 @@ getColours getColours _provider = for colourNames \ ( ColourName { colourName } ) -> do widget <- GTK.fixedNew -#if MIN_VERSION_GTK_4_10 GTK.widgetAddCssClass widget colourName - GTK.widgetGetColor widget -#else - style <- GTK.widgetGetStyleContext widget - GTK.styleContextAddProvider style _provider ( fromIntegral GTK.STYLE_PROVIDER_PRIORITY_USER ) - GTK.styleContextAddClass style colourName - GTK.styleContextGetColor style -#endif + GTK.widgetGetColor widget \ No newline at end of file diff --git a/src/app/MetaBrush/GTK/Util.hs b/src/app/MetaBrush/GTK/Util.hs index 1a174a5..1a935e6 100644 --- a/src/app/MetaBrush/GTK/Util.hs +++ b/src/app/MetaBrush/GTK/Util.hs @@ -1,4 +1,3 @@ -{-# LANGUAGE CPP #-} {-# LANGUAGE OverloadedStrings #-} {-# LANGUAGE ScopedTypeVariables #-} @@ -64,31 +63,17 @@ showRGBA rgba = withRGBA rgba \ r g b a -> widgetAddClasses :: ( HasCallStack, GTK.IsWidget widget, MonadIO m ) => widget -> [Text] -> m () widgetAddClasses widget classNames = -#if MIN_VERSION_GTK_4_10 for_ classNames ( GTK.widgetAddCssClass widget ) -#else - do - styleContext <- GTK.widgetGetStyleContext widget - for_ classNames ( GTK.styleContextAddClass styleContext ) -#endif widgetAddClass :: ( HasCallStack, GTK.IsWidget widget, MonadIO m ) => widget -> Text -> m () widgetAddClass widget className = -#if MIN_VERSION_GTK_4_10 GTK.widgetAddCssClass widget className -#else - GTK.widgetGetStyleContext widget >>= ( `GTK.styleContextAddClass` className ) -#endif -------------------------------------------------------------------------------- widgetShow :: ( HasCallStack, GTK.IsWidget widget, MonadIO m ) => widget -> m () widgetShow widget = -#if MIN_VERSION_GTK_4_10 GTK.widgetSetVisible widget True -#else - GTK.widgetShow widget -#endif --------------------------------------------------------------------------------