Skip to content

Commit

Permalink
Merge pull request ghcjs#119 from maralorn/bump-haskell-gi
Browse files Browse the repository at this point in the history
webkit2gtk: Make compatible with haskell-gi-base 0.24
  • Loading branch information
hamishmack authored Jun 26, 2021
2 parents 3bf079a + 4a62598 commit 376df8e
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions jsaddle-webkit2gtk/src/Language/Javascript/JSaddle/WebKitGTK.hs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,12 @@ import Language.Javascript.JSaddle (JSM, Results, Batch)
import Language.Javascript.JSaddle.Run (runJavaScript)
import Language.Javascript.JSaddle.Run.Files (initState, runBatch, ghcjsHelpers)

noAdjustment :: Maybe Adjustment
noAdjustment = Nothing

noCancellable :: Maybe Cancellable
noCancellable = Nothing

quitWebView :: WebView -> IO ()
quitWebView wv = postGUIAsync $ do w <- widgetGetToplevel wv --TODO: Shouldn't this be postGUISync?
widgetDestroy w
Expand All @@ -104,7 +110,7 @@ run main = do
_ <- timeoutAdd PRIORITY_HIGH 10 (yield >> return True)
windowSetDefaultSize window 900 600
windowSetPosition window WindowPositionCenter
scrollWin <- scrolledWindowNew (Nothing :: Maybe Adjustment) (Nothing :: Maybe Adjustment)
scrollWin <- scrolledWindowNew noAdjustment noAdjustment
contentManager <- userContentManagerNew
webView <- webViewNewWithUserContentManager contentManager
settings <- webViewGetSettings webView
Expand All @@ -128,11 +134,11 @@ run main = do
runInWebView :: JSM () -> WebView -> IO ()
runInWebView f webView = do
(processResults, syncResults, start) <- runJavaScript (\batch -> postGUIAsync $
webViewRunJavascript webView (decodeUtf8 . toStrict $ "runJSaddleBatch(" <> encode batch <> ");") (Nothing :: Maybe Cancellable) Nothing)
webViewRunJavascript webView (decodeUtf8 . toStrict $ "runJSaddleBatch(" <> encode batch <> ");") noCancellable Nothing)
f

addJSaddleHandler webView processResults syncResults
webViewRunJavascript webView (decodeUtf8 $ toStrict jsaddleJs) (Nothing :: Maybe Cancellable) . Just $
webViewRunJavascript webView (decodeUtf8 $ toStrict jsaddleJs) noCancellable . Just $
\_obj _asyncResult ->
void $ forkIO start

Expand Down

0 comments on commit 376df8e

Please # to comment.