HGL 3.2.3.1 → 3.2.3.2
raw patch · 3 files changed
+36/−12 lines, 3 filesdep +stm
Dependencies added: stm
Files
- Graphics/HGL/Draw/Region.hs +2/−1
- Graphics/HGL/Internals/Events.hs +24/−1
- HGL.cabal +10/−10
Graphics/HGL/Draw/Region.hs view
@@ -143,8 +143,9 @@ return (MkRegion r) regionToGraphic (MkRegion r) = mkDraw $ \ dc -> do+ (_, _, _, width, height, _, _) <- X.getGeometry (disp dc) (drawable dc) X.setRegion (disp dc) (brushGC dc) r- X.fillRectangle (disp dc) (drawable dc) (brushGC dc) 0 0 (-1) (-1) -- entire window (in 2s complement!)+ X.fillRectangle (disp dc) (drawable dc) (brushGC dc) 0 0 width height X.setRegion (disp dc) (brushGC dc) emptyXRegion return ()
Graphics/HGL/Internals/Events.hs view
@@ -18,9 +18,11 @@ getTick, sendTick ) where +import Control.Concurrent.STM (atomically)+import Control.Concurrent.STM.TChan(TChan, newTChanIO, readTChan, writeTChan, isEmptyTChan)+ import Graphics.HGL.Internals.Event import Graphics.HGL.Internals.Flag-import Control.Concurrent.Chan(Chan, newChan, readChan, writeChan, isEmptyChan) ---------------------------------------------------------------- -- Interface@@ -37,6 +39,8 @@ -- of the Graphics library). Exposure events in X11 behave in a -- similar way except that they do not overtake other events.) +type Chan = TChan+ data Events = Events { events :: Chan Event , tick :: Flag () }@@ -62,6 +66,25 @@ sendEvent evs = writeChan (events evs) sendTick evs = setFlag (tick evs) () getTick evs = resetFlag (tick evs)++----------------------------------------------------------------+-- TChan wrappers+--+-- As `isEmptyChan` was removed by+-- http://hackage.haskell.org/trac/ghc/ticket/4154, we can follow+-- suggestions in there and just replace Chan with TChan.+----------------------------------------------------------------+newChan :: IO (Chan a)+newChan = newTChanIO++readChan :: Chan a -> IO a+readChan = atomically . readTChan++writeChan :: Chan a -> a -> IO ()+writeChan c v = atomically $ writeTChan c v++isEmptyChan :: Chan a -> IO Bool+isEmptyChan = atomically . isEmptyTChan ---------------------------------------------------------------- -- End
HGL.cabal view
@@ -1,5 +1,5 @@ name: HGL-version: 3.2.3.1+version: 3.2.3.2 license: BSD3 license-file: LICENSE author: Alastair Reid@@ -7,14 +7,14 @@ category: Graphics synopsis: A simple graphics library based on X11 or Win32 description:- A simple graphics library, designed to give the programmer access- to most interesting parts of the Win32 Graphics Device Interface- and X11 library without exposing the programmer to the pain and- anguish usually associated with using these interfaces.- .- The library also includes a module Graphics.SOE providing the- interface used in "The Haskell School of Expression", by Paul- Hudak, cf <http://www.haskell.org/soe/>.+ A simple graphics library, designed to give the programmer access+ to most interesting parts of the Win32 Graphics Device Interface+ and X11 library without exposing the programmer to the pain and+ anguish usually associated with using these interfaces.+ .+ The library also includes a module Graphics.SOE providing the+ interface used in "The Haskell School of Expression", by Paul+ Hudak, cf <http://www.haskell.org/soe/>. build-type: Simple cabal-version: >= 1.2.1 @@ -22,7 +22,7 @@ library if flag(split-base)- build-depends: base >= 4.4.0.0 && < 5, array+ build-depends: base >= 4.4.0.0 && < 5, array, stm else build-depends: base < 2 exposed-modules: