GUI: fix signal handling for onExpose

Doing the signal handling connect inside the callback function
was a bad idea. Instead do it in the makeGUI function and just
call onClickedDrawButton for every expose event.
This commit is contained in:
hasufell 2014-10-11 00:01:43 +02:00
parent ab2a0a331d
commit b6aa9d9086
No known key found for this signature in database
GPG Key ID: 220CD1C5BDEED020
1 changed files with 3 additions and 4 deletions

View File

@ -114,6 +114,9 @@ makeGUI startFile = do
_ <- onResponse (aD mygui) (\x -> case x of
ResponseCancel -> widgetHideAll (aD mygui)
_ -> return ())
-- have to redraw for window overlapping and resizing on expose
_ <- onExpose (da mygui) (\_ -> onClickedDrawButton mygui >>=
(\_ -> return True))
-- hotkeys
_ <- win mygui `on` keyPressEvent $ tryEvent $ do
@ -146,10 +149,6 @@ onClickedDrawButton mygui = do
filename <- fileChooserGetFilename fcb
case filename of
Just x -> do
cId <- onExpose (da mygui) (\_ -> drawDiag' x mygui >>=
(\_ -> return True))
-- TODO: does not work properly
_ <- on fcb fileActivated (signalDisconnect cId)
ret <- drawDiag' x mygui
case ret of
1 -> showErrorDialog "No valid x/y dimensions!"