Opened 12 years ago

Closed 11 years ago

#15 closed defect (worksforme)

Window doesn't refresh under Gnome.

Reported by: Ben Lippmeier Owned by:
Priority: blocker Milestone:
Component: Rendering Version: 1.3.0
Keywords: Cc:

Description

I tried this in a typical Gnome environment, but the window never refreshed and X hogged 100% of the CPU.

{-# LANGUAGE CPP #-}
import Graphics.Gloss.Game
import Graphics.Gloss
import Data.Maybe (maybe)
import Debug.Trace

main = do
      let state = St Nothing []
      gameInWindow "Test Game" (1400,1050) (0,0) white 100 state makePicture handleEvent stepWorld

data State = St (Maybe Path) [Picture]
type Segment = ((Float, Float), (Float, Float))

makePicture :: State -> Picture
makePicture (St m xs) = Pictures (maybe xs (\x -> Line x : xs) m)

handleEvent :: Event -> State -> State
handleEvent e st = trace (show e) (handleE e st)

handleE (EventMotion (x,y)) st@(St (Just ps) ss) = St (Just ((x-418,516 - y):ps)) ss -- Here is the offset for a 1/2 window on xmonad
handleE (EventKey (MouseButton LeftButton) Down _ pt@(x,y)) st@(St Nothing ss) = St (Just [pt]) (Translate x y (Text "Down") : ss)
handleE (EventKey (MouseButton LeftButton) Up _ pt@(x,y)) st@(St (Just ps) ss) = St Nothing (Translate x y (Text "up") : Line (pt:ps) : ss)
handleE _ st = st

stepWorld :: Float -> State -> State
stepWorld _ = id

Change History (5)

comment:1 Changed 12 years ago by Ben Lippmeier

Component: UnknownRendering
Priority: normalblocker

comment:2 Changed 12 years ago by Ben Lippmeier

Milestone: 1.2.0.0

comment:3 Changed 11 years ago by Ben Lippmeier

Milestone: 1.4.0.0
Version: 1.1.1.01.3.0

comment:4 Changed 11 years ago by Ben Lippmeier

Milestone: 1.4.0.0

comment:5 Changed 11 years ago by Ben Lippmeier

Resolution: worksforme
Status: newclosed

Works for me with a standard Ubuntu 10.10 install in a Parallels VM. I've added the drawing application to the examples as gloss-draw.

Note: See TracTickets for help on using tickets.