mirror of
https://gitlab.com/sheaf/metabrush.git
synced 2024-11-23 15:34:06 +00:00
Require GTK >= 4.10
This commit is contained in:
parent
6ecfebd397
commit
60287fbf7e
|
@ -29,13 +29,6 @@ flag asserts
|
||||||
default: False
|
default: False
|
||||||
manual: True
|
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
|
common common
|
||||||
|
|
||||||
build-depends:
|
build-depends:
|
||||||
|
@ -165,13 +158,8 @@ common gtk
|
||||||
, haskell-gi-base
|
, haskell-gi-base
|
||||||
>= 0.26.8 && < 0.27
|
>= 0.26.8 && < 0.27
|
||||||
|
|
||||||
-- Workaround for https://github.com/haskell/cabal/issues/4237
|
pkgconfig-depends:
|
||||||
-- See https://github.com/commercialhaskell/stack/issues/2197
|
gtk4 >= 4.10
|
||||||
if flag(gtk-410)
|
|
||||||
pkgconfig-depends: gtk4 >= 4.10
|
|
||||||
cpp-options: -DMIN_VERSION_GTK_4_10
|
|
||||||
else
|
|
||||||
pkgconfig-depends: gtk4 < 4.10
|
|
||||||
|
|
||||||
library metabrushes
|
library metabrushes
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,3 @@
|
||||||
{-# LANGUAGE CPP #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
|
|
||||||
{-# OPTIONS_GHC -fno-warn-deprecations #-}
|
{-# OPTIONS_GHC -fno-warn-deprecations #-}
|
||||||
|
@ -94,12 +93,5 @@ getColours
|
||||||
getColours _provider =
|
getColours _provider =
|
||||||
for colourNames \ ( ColourName { colourName } ) -> do
|
for colourNames \ ( ColourName { colourName } ) -> do
|
||||||
widget <- GTK.fixedNew
|
widget <- GTK.fixedNew
|
||||||
#if MIN_VERSION_GTK_4_10
|
|
||||||
GTK.widgetAddCssClass widget colourName
|
GTK.widgetAddCssClass widget colourName
|
||||||
GTK.widgetGetColor widget
|
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
|
|
|
@ -1,4 +1,3 @@
|
||||||
{-# LANGUAGE CPP #-}
|
|
||||||
{-# LANGUAGE OverloadedStrings #-}
|
{-# LANGUAGE OverloadedStrings #-}
|
||||||
{-# LANGUAGE ScopedTypeVariables #-}
|
{-# 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 :: ( HasCallStack, GTK.IsWidget widget, MonadIO m ) => widget -> [Text] -> m ()
|
||||||
widgetAddClasses widget classNames =
|
widgetAddClasses widget classNames =
|
||||||
#if MIN_VERSION_GTK_4_10
|
|
||||||
for_ classNames ( GTK.widgetAddCssClass widget )
|
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 :: ( HasCallStack, GTK.IsWidget widget, MonadIO m ) => widget -> Text -> m ()
|
||||||
widgetAddClass widget className =
|
widgetAddClass widget className =
|
||||||
#if MIN_VERSION_GTK_4_10
|
|
||||||
GTK.widgetAddCssClass widget className
|
GTK.widgetAddCssClass widget className
|
||||||
#else
|
|
||||||
GTK.widgetGetStyleContext widget >>= ( `GTK.styleContextAddClass` className )
|
|
||||||
#endif
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
widgetShow :: ( HasCallStack, GTK.IsWidget widget, MonadIO m ) => widget -> m ()
|
widgetShow :: ( HasCallStack, GTK.IsWidget widget, MonadIO m ) => widget -> m ()
|
||||||
widgetShow widget =
|
widgetShow widget =
|
||||||
#if MIN_VERSION_GTK_4_10
|
|
||||||
GTK.widgetSetVisible widget True
|
GTK.widgetSetVisible widget True
|
||||||
#else
|
|
||||||
GTK.widgetShow widget
|
|
||||||
#endif
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue