{-# LANGUAGE OverloadedLabels #-} {-# LANGUAGE OverloadedStrings #-} module Main where import GI.Gtk as Gtk hiding (main) import qualified GI.Gtk as Gtk import GI.GObject.Functions import GI.GObject.Flags import Data.GI.Base.GType import Foreign.Ptr -- import Triangle as R -- import Lambda2 as R -- import Draw as R import LambdaHello as R main = do _ <- Gtk.init Nothing let mkChild = do gl <- gLAreaNew st <- R.initState _ <- on gl #realize $ R.realize st gl _ <- on gl #unrealize $ R.unrealize st gl _ <- on gl #render $ R.render st gl typ <- gobjectType gl ccSig <- signalLookup "create-context" typ ccid <- signalHandlerFind gl [SignalMatchTypeId] ccSig 0 -- detail Nothing -- closure nullPtr -- func nullPtr -- data ccqry <- signalQuery (fromIntegral ccid) print (gtypeToCGType typ,ccSig,ccid {-, ccqry -}) -- (66419360,233,0) _ <- on gl #createContext $ R.createContext st gl ccid <- signalHandlerFind gl [SignalMatchTypeId] ccSig 0 -- detail Nothing -- closure nullPtr -- func nullPtr -- data print (gtypeToCGType typ,ccSig,ccid {-, ccqry -}) -- (77669760,233,47) -- signalHandlerDisconnect gl ccid return gl window <- do w <- windowNew WindowTypeToplevel windowSetDefaultSize w 1000 1000 windowSetTitle w "GL Area" containerSetBorderWidth w 10 _ <- on w #deleteEvent $ \_ -> mainQuit >> return True child <- mkChild containerAdd w child return w widgetShowAll window Gtk.main