{-# LANGUAGE ConstraintKinds #-}
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE ExistentialQuantification #-}
{-# LANGUAGE FlexibleContexts #-}
{-# LANGUAGE FlexibleInstances #-}
{-# LANGUAGE MultiParamTypeClasses #-}
{-# LANGUAGE Strict #-}
module Monomer.Main.Types where
import Control.Applicative ((<|>))
import Control.Concurrent.Async
import Control.Concurrent.STM.TChan
import Control.Monad.Catch
import Control.Monad.State
import Data.Default
import Data.Map (Map)
import Data.Text (Text)
import Data.Typeable (Typeable)
import Data.Sequence (Seq)
import GHC.Generics
import qualified SDL
import qualified SDL.Raw.Types as SDLR
import Monomer.Common
import Monomer.Core.StyleTypes
import Monomer.Core.ThemeTypes
import Monomer.Core.WidgetTypes
import Monomer.Event.Types
import Monomer.Graphics.Types
import Data.ByteString (ByteString)
type MonomerM s e m = (Eq s, MonadState (MonomerCtx s e) m, MonadCatch m, MonadIO m)
data RenderMsg s e
= MsgInit (WidgetEnv s e) (WidgetNode s e)
| MsgRender (WidgetEnv s e) (WidgetNode s e)
| MsgResize Size
| MsgRemoveImage Text
| forall i . MsgRunInRender (TChan i) (IO i)
data RenderSetupResult
= RenderSetupSingle
| RenderSetupMulti
| RenderSetupMakeCurrentFailed String
deriving (RenderSetupResult -> RenderSetupResult -> Bool
(RenderSetupResult -> RenderSetupResult -> Bool)
-> (RenderSetupResult -> RenderSetupResult -> Bool)
-> Eq RenderSetupResult
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RenderSetupResult -> RenderSetupResult -> Bool
== :: RenderSetupResult -> RenderSetupResult -> Bool
$c/= :: RenderSetupResult -> RenderSetupResult -> Bool
/= :: RenderSetupResult -> RenderSetupResult -> Bool
Eq, Int -> RenderSetupResult -> ShowS
[RenderSetupResult] -> ShowS
RenderSetupResult -> String
(Int -> RenderSetupResult -> ShowS)
-> (RenderSetupResult -> String)
-> ([RenderSetupResult] -> ShowS)
-> Show RenderSetupResult
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RenderSetupResult -> ShowS
showsPrec :: Int -> RenderSetupResult -> ShowS
$cshow :: RenderSetupResult -> String
show :: RenderSetupResult -> String
$cshowList :: [RenderSetupResult] -> ShowS
showList :: [RenderSetupResult] -> ShowS
Show)
data RenderSchedule = RenderSchedule {
RenderSchedule -> WidgetId
_rsWidgetId :: WidgetId,
:: Millisecond,
RenderSchedule -> Millisecond
_rsMs :: Millisecond,
RenderSchedule -> Maybe Int
_rsRepeat :: Maybe Int
} deriving (RenderSchedule -> RenderSchedule -> Bool
(RenderSchedule -> RenderSchedule -> Bool)
-> (RenderSchedule -> RenderSchedule -> Bool) -> Eq RenderSchedule
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: RenderSchedule -> RenderSchedule -> Bool
== :: RenderSchedule -> RenderSchedule -> Bool
$c/= :: RenderSchedule -> RenderSchedule -> Bool
/= :: RenderSchedule -> RenderSchedule -> Bool
Eq, Int -> RenderSchedule -> ShowS
[RenderSchedule] -> ShowS
RenderSchedule -> String
(Int -> RenderSchedule -> ShowS)
-> (RenderSchedule -> String)
-> ([RenderSchedule] -> ShowS)
-> Show RenderSchedule
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> RenderSchedule -> ShowS
showsPrec :: Int -> RenderSchedule -> ShowS
$cshow :: RenderSchedule -> String
show :: RenderSchedule -> String
$cshowList :: [RenderSchedule] -> ShowS
showList :: [RenderSchedule] -> ShowS
Show, (forall x. RenderSchedule -> Rep RenderSchedule x)
-> (forall x. Rep RenderSchedule x -> RenderSchedule)
-> Generic RenderSchedule
forall x. Rep RenderSchedule x -> RenderSchedule
forall x. RenderSchedule -> Rep RenderSchedule x
forall a.
(forall x. a -> Rep a x) -> (forall x. Rep a x -> a) -> Generic a
$cfrom :: forall x. RenderSchedule -> Rep RenderSchedule x
from :: forall x. RenderSchedule -> Rep RenderSchedule x
$cto :: forall x. Rep RenderSchedule x -> RenderSchedule
to :: forall x. Rep RenderSchedule x -> RenderSchedule
Generic)
data DragAction = DragAction {
DragAction -> WidgetId
_dgaWidgetId :: WidgetId,
DragAction -> WidgetDragMsg
_dgaDragData :: WidgetDragMsg
} deriving (DragAction -> DragAction -> Bool
(DragAction -> DragAction -> Bool)
-> (DragAction -> DragAction -> Bool) -> Eq DragAction
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: DragAction -> DragAction -> Bool
== :: DragAction -> DragAction -> Bool
$c/= :: DragAction -> DragAction -> Bool
/= :: DragAction -> DragAction -> Bool
Eq, Int -> DragAction -> ShowS
[DragAction] -> ShowS
DragAction -> String
(Int -> DragAction -> ShowS)
-> (DragAction -> String)
-> ([DragAction] -> ShowS)
-> Show DragAction
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> DragAction -> ShowS
showsPrec :: Int -> DragAction -> ShowS
$cshow :: DragAction -> String
show :: DragAction -> String
$cshowList :: [DragAction] -> ShowS
showList :: [DragAction] -> ShowS
Show)
data WidgetTask
= forall i . Typeable i => WidgetTask WidgetId (Async i)
| forall i . Typeable i => WidgetProducer WidgetId (TChan i) (Async ())
data MonomerCtx s e = MonomerCtx {
forall s e. MonomerCtx s e -> s
_mcMainModel :: s,
forall s e. MonomerCtx s e -> Window
_mcWindow :: ~SDL.Window,
forall s e. MonomerCtx s e -> Size
_mcWindowSize :: Size,
forall s e. MonomerCtx s e -> Double
_mcDpr :: Double,
forall s e. MonomerCtx s e -> Double
_mcEpr :: Double,
forall s e.
MonomerCtx s e -> Either Renderer (TChan (RenderMsg s e))
_mcRenderMethod :: Either Renderer (TChan (RenderMsg s e)),
forall s e. MonomerCtx s e -> InputStatus
_mcInputStatus :: InputStatus,
forall s e. MonomerCtx s e -> [(WidgetId, CursorIcon)]
_mcCursorStack :: [(WidgetId, CursorIcon)],
forall s e. MonomerCtx s e -> WidgetId
_mcFocusedWidgetId :: WidgetId,
forall s e. MonomerCtx s e -> Maybe WidgetId
_mcHoveredWidgetId :: Maybe WidgetId,
forall s e. MonomerCtx s e -> Maybe WidgetId
_mcOverlayWidgetId :: Maybe WidgetId,
forall s e. MonomerCtx s e -> Maybe DragAction
_mcDragAction :: Maybe DragAction,
forall s e. MonomerCtx s e -> Maybe (Path, Point)
_mcMainBtnPress :: Maybe (Path, Point),
forall s e. MonomerCtx s e -> Seq WidgetTask
_mcWidgetTasks :: Seq WidgetTask,
forall s e. MonomerCtx s e -> Map WidgetId Path
_mcWidgetPaths :: Map WidgetId Path,
forall s e. MonomerCtx s e -> Map CursorIcon Cursor
_mcCursorIcons :: Map CursorIcon SDLR.Cursor,
forall s e. MonomerCtx s e -> Bool
_mcLeaveEnterPair :: Bool,
forall s e. MonomerCtx s e -> Seq WidgetId
_mcResizeRequests :: Seq WidgetId,
forall s e. MonomerCtx s e -> Bool
_mcRenderRequested :: Bool,
forall s e. MonomerCtx s e -> Map WidgetId RenderSchedule
_mcRenderSchedule :: Map WidgetId RenderSchedule,
forall s e. MonomerCtx s e -> Bool
_mcExitApplication :: Bool
}
data MainWindowState
= MainWindowNormal (Int, Int)
| MainWindowMaximized
| MainWindowFullScreen
deriving (MainWindowState -> MainWindowState -> Bool
(MainWindowState -> MainWindowState -> Bool)
-> (MainWindowState -> MainWindowState -> Bool)
-> Eq MainWindowState
forall a. (a -> a -> Bool) -> (a -> a -> Bool) -> Eq a
$c== :: MainWindowState -> MainWindowState -> Bool
== :: MainWindowState -> MainWindowState -> Bool
$c/= :: MainWindowState -> MainWindowState -> Bool
/= :: MainWindowState -> MainWindowState -> Bool
Eq, Int -> MainWindowState -> ShowS
[MainWindowState] -> ShowS
MainWindowState -> String
(Int -> MainWindowState -> ShowS)
-> (MainWindowState -> String)
-> ([MainWindowState] -> ShowS)
-> Show MainWindowState
forall a.
(Int -> a -> ShowS) -> (a -> String) -> ([a] -> ShowS) -> Show a
$cshowsPrec :: Int -> MainWindowState -> ShowS
showsPrec :: Int -> MainWindowState -> ShowS
$cshow :: MainWindowState -> String
show :: MainWindowState -> String
$cshowList :: [MainWindowState] -> ShowS
showList :: [MainWindowState] -> ShowS
Show)
data AppConfig s e = AppConfig {
forall s e. AppConfig s e -> Maybe MainWindowState
_apcWindowState :: Maybe MainWindowState,
forall s e. AppConfig s e -> Maybe Text
_apcWindowTitle :: Maybe Text,
forall s e. AppConfig s e -> Maybe Bool
_apcWindowResizable :: Maybe Bool,
forall s e. AppConfig s e -> Maybe Bool
_apcWindowBorder :: Maybe Bool,
forall s e. AppConfig s e -> Maybe Text
_apcWindowIcon :: Maybe Text,
forall s e. AppConfig s e -> Maybe Bool
_apcUseRenderThread :: Maybe Bool,
forall s e. AppConfig s e -> Maybe Int
_apcMaxFps :: Maybe Int,
forall s e. AppConfig s e -> Maybe Double
_apcScaleFactor :: Maybe Double,
forall s e. AppConfig s e -> Maybe Bool
_apcDisableAutoScale :: Maybe Bool,
forall s e. AppConfig s e -> [FontDef]
_apcFonts :: [FontDef],
forall s e. AppConfig s e -> Maybe Theme
_apcTheme :: Maybe Theme,
forall s e. AppConfig s e -> [e]
_apcInitEvent :: [e],
forall s e. AppConfig s e -> [e]
_apcDisposeEvent :: [e],
forall s e. AppConfig s e -> [e]
_apcExitEvent :: [e],
forall s e. AppConfig s e -> [Rect -> e]
_apcResizeEvent :: [Rect -> e],
forall s e. AppConfig s e -> Maybe Button
_apcMainButton :: Maybe Button,
forall s e. AppConfig s e -> Maybe Button
_apcContextButton :: Maybe Button,
forall s e. AppConfig s e -> Maybe Bool
_apcInvertWheelX :: Maybe Bool,
forall s e. AppConfig s e -> Maybe Bool
_apcInvertWheelY :: Maybe Bool,
forall s e. AppConfig s e -> Maybe Bool
_apcDisableCompositing :: Maybe Bool,
forall s e. AppConfig s e -> Maybe Bool
_apcDisableScreensaver :: Maybe Bool,
forall s e. AppConfig s e -> Maybe (s -> String)
_apcModelFingerprintFn :: Maybe (s -> String)
}
instance Default (AppConfig s e) where
def :: AppConfig s e
def = AppConfig {
_apcWindowState :: Maybe MainWindowState
_apcWindowState = Maybe MainWindowState
forall a. Maybe a
Nothing,
_apcWindowTitle :: Maybe Text
_apcWindowTitle = Maybe Text
forall a. Maybe a
Nothing,
_apcWindowResizable :: Maybe Bool
_apcWindowResizable = Maybe Bool
forall a. Maybe a
Nothing,
_apcWindowBorder :: Maybe Bool
_apcWindowBorder = Maybe Bool
forall a. Maybe a
Nothing,
_apcWindowIcon :: Maybe Text
_apcWindowIcon = Maybe Text
forall a. Maybe a
Nothing,
_apcUseRenderThread :: Maybe Bool
_apcUseRenderThread = Maybe Bool
forall a. Maybe a
Nothing,
_apcMaxFps :: Maybe Int
_apcMaxFps = Maybe Int
forall a. Maybe a
Nothing,
_apcScaleFactor :: Maybe Double
_apcScaleFactor = Maybe Double
forall a. Maybe a
Nothing,
_apcDisableAutoScale :: Maybe Bool
_apcDisableAutoScale = Maybe Bool
forall a. Maybe a
Nothing,
_apcFonts :: [FontDef]
_apcFonts = [],
_apcTheme :: Maybe Theme
_apcTheme = Maybe Theme
forall a. Maybe a
Nothing,
_apcInitEvent :: [e]
_apcInitEvent = [],
_apcDisposeEvent :: [e]
_apcDisposeEvent = [],
_apcExitEvent :: [e]
_apcExitEvent = [],
_apcResizeEvent :: [Rect -> e]
_apcResizeEvent = [],
_apcMainButton :: Maybe Button
_apcMainButton = Maybe Button
forall a. Maybe a
Nothing,
_apcContextButton :: Maybe Button
_apcContextButton = Maybe Button
forall a. Maybe a
Nothing,
_apcInvertWheelX :: Maybe Bool
_apcInvertWheelX = Maybe Bool
forall a. Maybe a
Nothing,
_apcInvertWheelY :: Maybe Bool
_apcInvertWheelY = Maybe Bool
forall a. Maybe a
Nothing,
_apcDisableCompositing :: Maybe Bool
_apcDisableCompositing = Maybe Bool
forall a. Maybe a
Nothing,
_apcDisableScreensaver :: Maybe Bool
_apcDisableScreensaver = Maybe Bool
forall a. Maybe a
Nothing,
_apcModelFingerprintFn :: Maybe (s -> String)
_apcModelFingerprintFn = Maybe (s -> String)
forall a. Maybe a
Nothing
}
instance Semigroup (AppConfig s e) where
<> :: AppConfig s e -> AppConfig s e -> AppConfig s e
(<>) AppConfig s e
a1 AppConfig s e
a2 = AppConfig {
_apcWindowState :: Maybe MainWindowState
_apcWindowState = AppConfig s e -> Maybe MainWindowState
forall s e. AppConfig s e -> Maybe MainWindowState
_apcWindowState AppConfig s e
a2 Maybe MainWindowState
-> Maybe MainWindowState -> Maybe MainWindowState
forall a. Maybe a -> Maybe a -> Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AppConfig s e -> Maybe MainWindowState
forall s e. AppConfig s e -> Maybe MainWindowState
_apcWindowState AppConfig s e
a1,
_apcWindowTitle :: Maybe Text
_apcWindowTitle = AppConfig s e -> Maybe Text
forall s e. AppConfig s e -> Maybe Text
_apcWindowTitle AppConfig s e
a2 Maybe Text -> Maybe Text -> Maybe Text
forall a. Maybe a -> Maybe a -> Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AppConfig s e -> Maybe Text
forall s e. AppConfig s e -> Maybe Text
_apcWindowTitle AppConfig s e
a1,
_apcWindowResizable :: Maybe Bool
_apcWindowResizable = AppConfig s e -> Maybe Bool
forall s e. AppConfig s e -> Maybe Bool
_apcWindowResizable AppConfig s e
a2 Maybe Bool -> Maybe Bool -> Maybe Bool
forall a. Maybe a -> Maybe a -> Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AppConfig s e -> Maybe Bool
forall s e. AppConfig s e -> Maybe Bool
_apcWindowResizable AppConfig s e
a1,
_apcWindowBorder :: Maybe Bool
_apcWindowBorder = AppConfig s e -> Maybe Bool
forall s e. AppConfig s e -> Maybe Bool
_apcWindowBorder AppConfig s e
a2 Maybe Bool -> Maybe Bool -> Maybe Bool
forall a. Maybe a -> Maybe a -> Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AppConfig s e -> Maybe Bool
forall s e. AppConfig s e -> Maybe Bool
_apcWindowBorder AppConfig s e
a1,
_apcWindowIcon :: Maybe Text
_apcWindowIcon = AppConfig s e -> Maybe Text
forall s e. AppConfig s e -> Maybe Text
_apcWindowIcon AppConfig s e
a2 Maybe Text -> Maybe Text -> Maybe Text
forall a. Maybe a -> Maybe a -> Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AppConfig s e -> Maybe Text
forall s e. AppConfig s e -> Maybe Text
_apcWindowIcon AppConfig s e
a1,
_apcUseRenderThread :: Maybe Bool
_apcUseRenderThread = AppConfig s e -> Maybe Bool
forall s e. AppConfig s e -> Maybe Bool
_apcUseRenderThread AppConfig s e
a2 Maybe Bool -> Maybe Bool -> Maybe Bool
forall a. Maybe a -> Maybe a -> Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AppConfig s e -> Maybe Bool
forall s e. AppConfig s e -> Maybe Bool
_apcUseRenderThread AppConfig s e
a1,
_apcMaxFps :: Maybe Int
_apcMaxFps = AppConfig s e -> Maybe Int
forall s e. AppConfig s e -> Maybe Int
_apcMaxFps AppConfig s e
a2 Maybe Int -> Maybe Int -> Maybe Int
forall a. Maybe a -> Maybe a -> Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AppConfig s e -> Maybe Int
forall s e. AppConfig s e -> Maybe Int
_apcMaxFps AppConfig s e
a1,
_apcScaleFactor :: Maybe Double
_apcScaleFactor = AppConfig s e -> Maybe Double
forall s e. AppConfig s e -> Maybe Double
_apcScaleFactor AppConfig s e
a2 Maybe Double -> Maybe Double -> Maybe Double
forall a. Maybe a -> Maybe a -> Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AppConfig s e -> Maybe Double
forall s e. AppConfig s e -> Maybe Double
_apcScaleFactor AppConfig s e
a1,
_apcDisableAutoScale :: Maybe Bool
_apcDisableAutoScale = AppConfig s e -> Maybe Bool
forall s e. AppConfig s e -> Maybe Bool
_apcDisableAutoScale AppConfig s e
a2 Maybe Bool -> Maybe Bool -> Maybe Bool
forall a. Maybe a -> Maybe a -> Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AppConfig s e -> Maybe Bool
forall s e. AppConfig s e -> Maybe Bool
_apcDisableAutoScale AppConfig s e
a1,
_apcFonts :: [FontDef]
_apcFonts = AppConfig s e -> [FontDef]
forall s e. AppConfig s e -> [FontDef]
_apcFonts AppConfig s e
a1 [FontDef] -> [FontDef] -> [FontDef]
forall a. [a] -> [a] -> [a]
++ AppConfig s e -> [FontDef]
forall s e. AppConfig s e -> [FontDef]
_apcFonts AppConfig s e
a2,
_apcTheme :: Maybe Theme
_apcTheme = AppConfig s e -> Maybe Theme
forall s e. AppConfig s e -> Maybe Theme
_apcTheme AppConfig s e
a2 Maybe Theme -> Maybe Theme -> Maybe Theme
forall a. Maybe a -> Maybe a -> Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AppConfig s e -> Maybe Theme
forall s e. AppConfig s e -> Maybe Theme
_apcTheme AppConfig s e
a1,
_apcInitEvent :: [e]
_apcInitEvent = AppConfig s e -> [e]
forall s e. AppConfig s e -> [e]
_apcInitEvent AppConfig s e
a1 [e] -> [e] -> [e]
forall a. [a] -> [a] -> [a]
++ AppConfig s e -> [e]
forall s e. AppConfig s e -> [e]
_apcInitEvent AppConfig s e
a2,
_apcDisposeEvent :: [e]
_apcDisposeEvent = AppConfig s e -> [e]
forall s e. AppConfig s e -> [e]
_apcDisposeEvent AppConfig s e
a1 [e] -> [e] -> [e]
forall a. [a] -> [a] -> [a]
++ AppConfig s e -> [e]
forall s e. AppConfig s e -> [e]
_apcDisposeEvent AppConfig s e
a2,
_apcExitEvent :: [e]
_apcExitEvent = AppConfig s e -> [e]
forall s e. AppConfig s e -> [e]
_apcExitEvent AppConfig s e
a1 [e] -> [e] -> [e]
forall a. [a] -> [a] -> [a]
++ AppConfig s e -> [e]
forall s e. AppConfig s e -> [e]
_apcExitEvent AppConfig s e
a2,
_apcResizeEvent :: [Rect -> e]
_apcResizeEvent = AppConfig s e -> [Rect -> e]
forall s e. AppConfig s e -> [Rect -> e]
_apcResizeEvent AppConfig s e
a1 [Rect -> e] -> [Rect -> e] -> [Rect -> e]
forall a. [a] -> [a] -> [a]
++ AppConfig s e -> [Rect -> e]
forall s e. AppConfig s e -> [Rect -> e]
_apcResizeEvent AppConfig s e
a2,
_apcMainButton :: Maybe Button
_apcMainButton = AppConfig s e -> Maybe Button
forall s e. AppConfig s e -> Maybe Button
_apcMainButton AppConfig s e
a2 Maybe Button -> Maybe Button -> Maybe Button
forall a. Maybe a -> Maybe a -> Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AppConfig s e -> Maybe Button
forall s e. AppConfig s e -> Maybe Button
_apcMainButton AppConfig s e
a1,
_apcContextButton :: Maybe Button
_apcContextButton = AppConfig s e -> Maybe Button
forall s e. AppConfig s e -> Maybe Button
_apcContextButton AppConfig s e
a2 Maybe Button -> Maybe Button -> Maybe Button
forall a. Maybe a -> Maybe a -> Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AppConfig s e -> Maybe Button
forall s e. AppConfig s e -> Maybe Button
_apcContextButton AppConfig s e
a1,
_apcInvertWheelX :: Maybe Bool
_apcInvertWheelX = AppConfig s e -> Maybe Bool
forall s e. AppConfig s e -> Maybe Bool
_apcInvertWheelX AppConfig s e
a2 Maybe Bool -> Maybe Bool -> Maybe Bool
forall a. Maybe a -> Maybe a -> Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AppConfig s e -> Maybe Bool
forall s e. AppConfig s e -> Maybe Bool
_apcInvertWheelX AppConfig s e
a1,
_apcInvertWheelY :: Maybe Bool
_apcInvertWheelY = AppConfig s e -> Maybe Bool
forall s e. AppConfig s e -> Maybe Bool
_apcInvertWheelY AppConfig s e
a2 Maybe Bool -> Maybe Bool -> Maybe Bool
forall a. Maybe a -> Maybe a -> Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AppConfig s e -> Maybe Bool
forall s e. AppConfig s e -> Maybe Bool
_apcInvertWheelY AppConfig s e
a1,
_apcDisableCompositing :: Maybe Bool
_apcDisableCompositing = AppConfig s e -> Maybe Bool
forall s e. AppConfig s e -> Maybe Bool
_apcDisableCompositing AppConfig s e
a2 Maybe Bool -> Maybe Bool -> Maybe Bool
forall a. Maybe a -> Maybe a -> Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AppConfig s e -> Maybe Bool
forall s e. AppConfig s e -> Maybe Bool
_apcDisableCompositing AppConfig s e
a1,
_apcDisableScreensaver :: Maybe Bool
_apcDisableScreensaver = AppConfig s e -> Maybe Bool
forall s e. AppConfig s e -> Maybe Bool
_apcDisableScreensaver AppConfig s e
a2 Maybe Bool -> Maybe Bool -> Maybe Bool
forall a. Maybe a -> Maybe a -> Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AppConfig s e -> Maybe Bool
forall s e. AppConfig s e -> Maybe Bool
_apcDisableScreensaver AppConfig s e
a1,
_apcModelFingerprintFn :: Maybe (s -> String)
_apcModelFingerprintFn = AppConfig s e -> Maybe (s -> String)
forall s e. AppConfig s e -> Maybe (s -> String)
_apcModelFingerprintFn AppConfig s e
a2 Maybe (s -> String) -> Maybe (s -> String) -> Maybe (s -> String)
forall a. Maybe a -> Maybe a -> Maybe a
forall (f :: * -> *) a. Alternative f => f a -> f a -> f a
<|> AppConfig s e -> Maybe (s -> String)
forall s e. AppConfig s e -> Maybe (s -> String)
_apcModelFingerprintFn AppConfig s e
a1
}
instance Monoid (AppConfig s e) where
mempty :: AppConfig s e
mempty = AppConfig s e
forall a. Default a => a
def
appWindowState :: MainWindowState -> AppConfig s e
appWindowState :: forall s e. MainWindowState -> AppConfig s e
appWindowState MainWindowState
title = AppConfig s e
forall a. Default a => a
def {
_apcWindowState = Just title
}
appWindowTitle :: Text -> AppConfig s e
appWindowTitle :: forall s e. Text -> AppConfig s e
appWindowTitle Text
title = AppConfig s e
forall a. Default a => a
def {
_apcWindowTitle = Just title
}
appWindowResizable :: Bool -> AppConfig s e
appWindowResizable :: forall s e. Bool -> AppConfig s e
appWindowResizable Bool
resizable = AppConfig s e
forall a. Default a => a
def {
_apcWindowResizable = Just resizable
}
appWindowBorder :: Bool -> AppConfig s e
appWindowBorder :: forall s e. Bool -> AppConfig s e
appWindowBorder Bool
border = AppConfig s e
forall a. Default a => a
def {
_apcWindowBorder = Just border
}
appWindowIcon :: Text -> AppConfig s e
appWindowIcon :: forall s e. Text -> AppConfig s e
appWindowIcon Text
path = AppConfig s e
forall a. Default a => a
def {
_apcWindowIcon = Just path
}
{-# DEPRECATED appRenderOnMainThread
"Should no longer be needed. Check appRenderOnMainThread's Haddock page." #-}
appRenderOnMainThread :: AppConfig s e
appRenderOnMainThread :: forall s e. AppConfig s e
appRenderOnMainThread = AppConfig s e
forall a. Default a => a
def {
_apcUseRenderThread = Just False
}
appMaxFps :: Int -> AppConfig s e
appMaxFps :: forall s e. Int -> AppConfig s e
appMaxFps Int
fps = AppConfig s e
forall a. Default a => a
def {
_apcMaxFps = Just fps
}
appScaleFactor :: Double -> AppConfig s e
appScaleFactor :: forall s e. Double -> AppConfig s e
appScaleFactor Double
factor = AppConfig s e
forall a. Default a => a
def {
_apcScaleFactor = Just factor
}
appDisableAutoScale :: Bool -> AppConfig s e
appDisableAutoScale :: forall s e. Bool -> AppConfig s e
appDisableAutoScale Bool
disable = AppConfig s e
forall a. Default a => a
def {
_apcDisableAutoScale = Just disable
}
appFontDef :: Text -> Text -> AppConfig s e
appFontDef :: forall s e. Text -> Text -> AppConfig s e
appFontDef Text
name Text
path = AppConfig s e
forall a. Default a => a
def {
_apcFonts = [ FontDefFile name path ]
}
appFontDefMem :: Text -> ByteString -> AppConfig s e
appFontDefMem :: forall s e. Text -> ByteString -> AppConfig s e
appFontDefMem Text
name ByteString
bytes = AppConfig s e
forall a. Default a => a
def {
_apcFonts = [ FontDefMem name bytes ]
}
appTheme :: Theme -> AppConfig s e
appTheme :: forall s e. Theme -> AppConfig s e
appTheme Theme
t = AppConfig s e
forall a. Default a => a
def {
_apcTheme = Just t
}
appInitEvent :: e -> AppConfig s e
appInitEvent :: forall e s. e -> AppConfig s e
appInitEvent e
evt = AppConfig s e
forall a. Default a => a
def {
_apcInitEvent = [evt]
}
appDisposeEvent :: e -> AppConfig s e
appDisposeEvent :: forall e s. e -> AppConfig s e
appDisposeEvent e
evt = AppConfig s e
forall a. Default a => a
def {
_apcDisposeEvent = [evt]
}
appExitEvent :: e -> AppConfig s e
appExitEvent :: forall e s. e -> AppConfig s e
appExitEvent e
evt = AppConfig s e
forall a. Default a => a
def {
_apcExitEvent = [evt]
}
appResizeEvent :: (Rect -> e) -> AppConfig s e
appResizeEvent :: forall e s. (Rect -> e) -> AppConfig s e
appResizeEvent Rect -> e
evt = AppConfig s e
forall a. Default a => a
def {
_apcResizeEvent = [evt]
}
appMainButton :: Button -> AppConfig s e
appMainButton :: forall s e. Button -> AppConfig s e
appMainButton Button
btn = AppConfig s e
forall a. Default a => a
def {
_apcMainButton = Just btn
}
appContextButton :: Button -> AppConfig s e
appContextButton :: forall s e. Button -> AppConfig s e
appContextButton Button
btn = AppConfig s e
forall a. Default a => a
def {
_apcContextButton = Just btn
}
appInvertWheelX :: Bool -> AppConfig s e
appInvertWheelX :: forall s e. Bool -> AppConfig s e
appInvertWheelX Bool
invert = AppConfig s e
forall a. Default a => a
def {
_apcInvertWheelX = Just invert
}
appInvertWheelY :: Bool -> AppConfig s e
appInvertWheelY :: forall s e. Bool -> AppConfig s e
appInvertWheelY Bool
invert = AppConfig s e
forall a. Default a => a
def {
_apcInvertWheelY = Just invert
}
appDisableCompositing :: Bool -> AppConfig s e
appDisableCompositing :: forall s e. Bool -> AppConfig s e
appDisableCompositing Bool
disable = AppConfig s e
forall a. Default a => a
def {
_apcDisableCompositing = Just disable
}
appDisableScreensaver :: Bool -> AppConfig s e
appDisableScreensaver :: forall s e. Bool -> AppConfig s e
appDisableScreensaver Bool
disable = AppConfig s e
forall a. Default a => a
def {
_apcDisableScreensaver = Just disable
}
appModelFingerprint :: (s -> String) -> AppConfig s e
appModelFingerprint :: forall s e. (s -> String) -> AppConfig s e
appModelFingerprint s -> String
fn = AppConfig Any e
forall a. Default a => a
def {
_apcModelFingerprintFn = Just fn
}