@@ -38,6 +38,7 @@ import Graphics.Rendering.Cairo ( liftIO )
3838
3939import Data.IORef
4040import Control.Monad
41+ import Control.Monad.Trans
4142import qualified Data.Text as T
4243
4344-----------------------------------------------------------------------------
@@ -78,7 +79,7 @@ timelineGetViewParameters :: TimelineView -> IO ViewParameters
7879timelineGetViewParameters TimelineView {tracesIORef, bwmodeIORef, labelsModeIORef,
7980 timelineState= TimelineState {.. }} = do
8081
81- (w, _) <- widgetGetSize timelineDrawingArea
82+ Rectangle _ _ w _ <- widgetGetAllocation timelineDrawingArea
8283 scaleValue <- readIORef scaleIORef
8384 maxSpkValue <- readIORef maxSpkIORef
8485
@@ -90,7 +91,7 @@ timelineGetViewParameters TimelineView{tracesIORef, bwmodeIORef, labelsModeIORef
9091 bwmode <- readIORef bwmodeIORef
9192 labelsMode <- readIORef labelsModeIORef
9293
93- (_, xScaleAreaHeight) <- widgetGetSize timelineXScaleArea
94+ Rectangle _ _ _ xScaleAreaHeight <- widgetGetAllocation timelineXScaleArea
9495 let histTotalHeight = stdHistogramHeight + histXScaleHeight
9596 timelineHeight =
9697 calculateTotalTimelineHeight labelsMode histTotalHeight traces
@@ -169,32 +170,32 @@ timelineViewNew builder actions = do
169170
170171 ------------------------------------------------------------------------
171172 -- Redrawing labelDrawingArea
172- timelineYScaleArea `onExpose` \ _ -> do
173+ timelineYScaleArea `on` draw $ liftIO $ do
173174 maybeEventArray <- readIORef hecsIORef
174175
175176 -- Check to see if an event trace has been loaded
176177 case maybeEventArray of
177- Nothing -> return False
178+ Nothing -> return ()
178179 Just hecs -> do
179180 traces <- readIORef tracesIORef
180181 labelsMode <- readIORef labelsModeIORef
181182 let maxP = maxSparkPool hecs
182183 maxH = fromIntegral (maxYHistogram hecs)
183184 updateYScaleArea timelineState maxP maxH Nothing labelsMode traces
184- return True
185+ return ()
185186
186187 ------------------------------------------------------------------------
187188 -- Redrawing XScaleArea
188- timelineXScaleArea `onExpose` \ _ -> do
189+ timelineXScaleArea `on` draw $ liftIO $ do
189190 maybeEventArray <- readIORef hecsIORef
190191
191192 -- Check to see if an event trace has been loaded
192193 case maybeEventArray of
193- Nothing -> return False
194+ Nothing -> return ()
194195 Just hecs -> do
195196 let lastTx = hecLastEventTime hecs
196197 updateXScaleArea timelineState lastTx
197- return True
198+ return ()
198199
199200 ------------------------------------------------------------------------
200201 -- Allow mouse wheel to be used for zoom in/out
@@ -253,7 +254,7 @@ timelineViewNew builder actions = do
253254 in withMouseState whenNoMouse >> return True
254255 keyName <- eventKeyName
255256 keyVal <- eventKeyVal
256- #if MIN_VERSION_gtk (0,13,0)
257+ #if MIN_VERSION_gtk3 (0,13,0)
257258 case (T. unpack keyName, keyToChar keyVal, keyVal) of
258259#else
259260 case (keyName, keyToChar keyVal, keyVal) of
@@ -277,8 +278,7 @@ timelineViewNew builder actions = do
277278 ------------------------------------------------------------------------
278279 -- Redrawing
279280
280- on timelineDrawingArea exposeEvent $ do
281- exposeRegion <- eventRegion
281+ on timelineDrawingArea draw $ do
282282 liftIO $ do
283283 maybeEventArray <- readIORef hecsIORef
284284
@@ -290,14 +290,15 @@ timelineViewNew builder actions = do
290290 -- render either the whole height of the timeline, or the window, whichever
291291 -- is larger (this just ensure we fill the background if the timeline is
292292 -- smaller than the window).
293- (_, h) <- widgetGetSize timelineDrawingArea
293+ exposeRect <- widgetGetAllocation timelineDrawingArea
294+ Rectangle _ _ _ h <- widgetGetAllocation timelineDrawingArea
294295 let params' = params { height = max (height params) h }
295296 selection <- readIORef selectionRef
296297 bookmarks <- readIORef bookmarkIORef
297298
298- renderView timelineState params' hecs selection bookmarks exposeRegion
299+ renderView timelineState params' hecs selection bookmarks exposeRect
299300
300- return True
301+ return ()
301302
302303 on timelineDrawingArea configureEvent $ do
303304 liftIO $ configureTimelineDrawingArea timelineWin
@@ -357,7 +358,7 @@ updateTimelineVScroll TimelineView{tracesIORef, labelsModeIORef, timelineState=T
357358 labelsMode <- readIORef labelsModeIORef
358359 let histTotalHeight = stdHistogramHeight + histXScaleHeight
359360 h = calculateTotalTimelineHeight labelsMode histTotalHeight traces
360- (_, winh) <- widgetGetSize timelineDrawingArea
361+ Rectangle _ _ _ winh <- widgetGetAllocation timelineDrawingArea
361362 let winh' = fromIntegral winh;
362363 h' = fromIntegral h
363364 adjustmentSetLower timelineVAdj 0
@@ -377,7 +378,7 @@ updateTimelineVScroll TimelineView{tracesIORef, labelsModeIORef, timelineState=T
377378-- the view at all.
378379updateTimelineHPageSize :: TimelineState -> IO ()
379380updateTimelineHPageSize TimelineState {.. } = do
380- ( winw,_) <- widgetGetSize timelineDrawingArea
381+ Rectangle _ _ winw _ <- widgetGetAllocation timelineDrawingArea
381382 scaleValue <- readIORef scaleIORef
382383 adjustmentSetPageSize timelineAdj (fromIntegral winw * scaleValue)
383384
@@ -467,8 +468,9 @@ mouseRelease view@TimelineView{..} TimelineViewActions{..} state button x =
467468
468469widgetSetCursor :: WidgetClass widget => widget -> Maybe Cursor -> IO ()
469470widgetSetCursor widget cursor = do
470- #if MIN_VERSION_gtk(0,12,1)
471- dw <- widgetGetDrawWindow widget
471+ #if MIN_VERSION_gtk3(0,12,1)
472+ -- TODO: get rid of this Just
473+ Just dw <- widgetGetWindow widget
472474 drawWindowSetCursor dw cursor
473475#endif
474476 return ()
0 commit comments