Karya, built on 2023-08-29T07:47:28 (patch 7a412d5d6ba4968ca4155ef276a062ccdeb9109a)
Safe HaskellSafe-Inferred

Ui.Fltk

Description

This has the FLTK event thread, and communication with it.

Synopsis

Documentation

data Fltk a Source #

You should only talk to FLTK from the main thread, which is also the FLTK event thread. So to call a FLTK function, you have to put it on the UI Channel, where the FLTK thread will pick it up. This also serializes them, so I don't have to worry about concurrency at the Fltk layer. Since FLTK operations are wrapped in Fltk, and only this module can unwrap a Fltk, this should enforce that you can't cell them willy-nilly.

Instances

Instances details
MonadIO Fltk Source # 
Instance details

Defined in Ui.Fltk

Methods

liftIO :: IO a -> Fltk a #

Applicative Fltk Source # 
Instance details

Defined in Ui.Fltk

Methods

pure :: a -> Fltk a #

(<*>) :: Fltk (a -> b) -> Fltk a -> Fltk b #

liftA2 :: (a -> b -> c) -> Fltk a -> Fltk b -> Fltk c #

(*>) :: Fltk a -> Fltk b -> Fltk b #

(<*) :: Fltk a -> Fltk b -> Fltk a #

Functor Fltk Source # 
Instance details

Defined in Ui.Fltk

Methods

fmap :: (a -> b) -> Fltk a -> Fltk b #

(<$) :: a -> Fltk b -> Fltk a #

Monad Fltk Source # 
Instance details

Defined in Ui.Fltk

Methods

(>>=) :: Fltk a -> (a -> Fltk b) -> Fltk b #

(>>) :: Fltk a -> Fltk b -> Fltk b #

return :: a -> Fltk a #

fltk :: IO a -> Fltk a Source #

type Channel = MVar.MVar [(Fltk (), Text)] Source #

Channel to communicate with the FLTK event loop. Yes it's not a real channel, but I want to get all actions in one go, and an MVar is suitable for that.

event_loop :: Channel -> QuitRequest -> TChan UiMsg.UiMsg -> IO () Source #

Run the FLTK event loop thread, passing it a channel that produces msgs, and go into the UI polling loop. This is intended to be run from the main thread, since some UIs don't work properly unless run from the main thread. When the app exits, the ui loop will be aborted.

send_action :: Channel -> Text -> Fltk () -> IO () Source #

Send the UI to the ui thread to run asynchronously.

quit_ui_thread :: QuitRequest -> IO () Source #