gtkglext 0.11.1 → 0.12.0
raw patch · 8 files changed
+68/−40 lines, 8 filesdep ~cairodep ~glibdep ~gtksetup-changedPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: cairo, glib, gtk, pango
API changes (from Hackage documentation)
- Graphics.UI.Gtk.OpenGL.Config: castToGLConfig :: (GObjectClass obj) => obj -> GLConfig
+ Graphics.UI.Gtk.OpenGL.Config: castToGLConfig :: GObjectClass obj => obj -> GLConfig
- Graphics.UI.Gtk.OpenGL.Config: class (GObjectClass o) => GLConfigClass o
+ Graphics.UI.Gtk.OpenGL.Config: class GObjectClass o => GLConfigClass o
- Graphics.UI.Gtk.OpenGL.Config: toGLConfig :: (GLConfigClass o) => o -> GLConfig
+ Graphics.UI.Gtk.OpenGL.Config: toGLConfig :: GLConfigClass o => o -> GLConfig
- Graphics.UI.Gtk.OpenGL.Context: castToGLContext :: (GObjectClass obj) => obj -> GLContext
+ Graphics.UI.Gtk.OpenGL.Context: castToGLContext :: GObjectClass obj => obj -> GLContext
- Graphics.UI.Gtk.OpenGL.Context: class (GObjectClass o) => GLContextClass o
+ Graphics.UI.Gtk.OpenGL.Context: class GObjectClass o => GLContextClass o
- Graphics.UI.Gtk.OpenGL.Context: glContextNew :: (GLDrawableClass gldrawable) => gldrawable -> Maybe GLContext -> Bool -> GLRenderType -> IO GLContext
+ Graphics.UI.Gtk.OpenGL.Context: glContextNew :: GLDrawableClass gldrawable => gldrawable -> Maybe GLContext -> Bool -> GLRenderType -> IO GLContext
- Graphics.UI.Gtk.OpenGL.Drawable: castToGLDrawable :: (GObjectClass obj) => obj -> GLDrawable
+ Graphics.UI.Gtk.OpenGL.Drawable: castToGLDrawable :: GObjectClass obj => obj -> GLDrawable
- Graphics.UI.Gtk.OpenGL.Drawable: class (GObjectClass o) => GLDrawableClass o
+ Graphics.UI.Gtk.OpenGL.Drawable: class GObjectClass o => GLDrawableClass o
- Graphics.UI.Gtk.OpenGL.Drawable: glDrawableGLBegin :: (GLDrawableClass self) => self -> GLContext -> IO Bool
+ Graphics.UI.Gtk.OpenGL.Drawable: glDrawableGLBegin :: GLDrawableClass self => self -> GLContext -> IO Bool
- Graphics.UI.Gtk.OpenGL.Drawable: glDrawableGLEnd :: (GLDrawableClass self) => self -> IO ()
+ Graphics.UI.Gtk.OpenGL.Drawable: glDrawableGLEnd :: GLDrawableClass self => self -> IO ()
- Graphics.UI.Gtk.OpenGL.Drawable: glDrawableGetGLConfig :: (GLDrawableClass self) => self -> IO GLConfig
+ Graphics.UI.Gtk.OpenGL.Drawable: glDrawableGetGLConfig :: GLDrawableClass self => self -> IO GLConfig
- Graphics.UI.Gtk.OpenGL.Drawable: glDrawableGetSize :: (GLDrawableClass self) => self -> IO (Int, Int)
+ Graphics.UI.Gtk.OpenGL.Drawable: glDrawableGetSize :: GLDrawableClass self => self -> IO (Int, Int)
- Graphics.UI.Gtk.OpenGL.Drawable: glDrawableIsDoubleBuffered :: (GLDrawableClass self) => self -> IO Bool
+ Graphics.UI.Gtk.OpenGL.Drawable: glDrawableIsDoubleBuffered :: GLDrawableClass self => self -> IO Bool
- Graphics.UI.Gtk.OpenGL.Drawable: glDrawableMakeCurrent :: (GLDrawableClass self) => self -> GLContext -> IO Bool
+ Graphics.UI.Gtk.OpenGL.Drawable: glDrawableMakeCurrent :: GLDrawableClass self => self -> GLContext -> IO Bool
- Graphics.UI.Gtk.OpenGL.Drawable: glDrawableSwapBuffers :: (GLDrawableClass self) => self -> IO ()
+ Graphics.UI.Gtk.OpenGL.Drawable: glDrawableSwapBuffers :: GLDrawableClass self => self -> IO ()
- Graphics.UI.Gtk.OpenGL.Drawable: glDrawableWaitGL :: (GLDrawableClass self) => self -> IO ()
+ Graphics.UI.Gtk.OpenGL.Drawable: glDrawableWaitGL :: GLDrawableClass self => self -> IO ()
- Graphics.UI.Gtk.OpenGL.Drawable: glDrawableWaitGdk :: (GLDrawableClass self) => self -> IO ()
+ Graphics.UI.Gtk.OpenGL.Drawable: glDrawableWaitGdk :: GLDrawableClass self => self -> IO ()
- Graphics.UI.Gtk.OpenGL.Drawable: toGLDrawable :: (GLDrawableClass o) => o -> GLDrawable
+ Graphics.UI.Gtk.OpenGL.Drawable: toGLDrawable :: GLDrawableClass o => o -> GLDrawable
- Graphics.UI.Gtk.OpenGL.Pixmap: castToGLPixmap :: (GObjectClass obj) => obj -> GLPixmap
+ Graphics.UI.Gtk.OpenGL.Pixmap: castToGLPixmap :: GObjectClass obj => obj -> GLPixmap
- Graphics.UI.Gtk.OpenGL.Pixmap: class (DrawableClass o) => GLPixmapClass o
+ Graphics.UI.Gtk.OpenGL.Pixmap: class DrawableClass o => GLPixmapClass o
- Graphics.UI.Gtk.OpenGL.Window: castToGLWindow :: (GObjectClass obj) => obj -> GLWindow
+ Graphics.UI.Gtk.OpenGL.Window: castToGLWindow :: GObjectClass obj => obj -> GLWindow
- Graphics.UI.Gtk.OpenGL.Window: class (DrawableClass o) => GLWindowClass o
+ Graphics.UI.Gtk.OpenGL.Window: class DrawableClass o => GLWindowClass o
Files
- Graphics/UI/Gtk/OpenGL/Config.chs +3/−3
- Graphics/UI/Gtk/OpenGL/Context.chs +2/−2
- Graphics/UI/Gtk/OpenGL/Pixmap.chs +2/−2
- Graphics/UI/Gtk/OpenGL/Window.chs +2/−2
- Gtk2HsSetup.hs +44/−19
- Setup.hs +5/−2
- demo/RotatingCube.hs +5/−5
- gtkglext.cabal +5/−5
Graphics/UI/Gtk/OpenGL/Config.chs view
@@ -59,7 +59,7 @@ import System.Glib.FFI import System.Glib.Flags-import System.Glib.GObject (makeNewGObject)+import System.Glib.GObject (makeNewGObject, wrapNewGObject) {#import Graphics.UI.Gtk.OpenGL.Types#} {# context lib="gtkglext" prefix="gdk" #}@@ -113,7 +113,7 @@ [GLConfigMode] -- ^ @mode@ - display mode bit mask. -> IO GLConfig glConfigNew mode =- makeNewGObject mkGLConfig $+ wrapNewGObject mkGLConfig $ {# call gdk_gl_config_new_by_mode #} ((fromIntegral . fromFlags) mode) @@ -125,7 +125,7 @@ -> [GLConfigMode] -- ^ @mode@ - display mode. -> IO GLConfig glConfigNewForScreen screen mode =- makeNewGObject mkGLConfig $+ wrapNewGObject mkGLConfig $ {# call gdk_gl_config_new_by_mode_for_screen #} screen ((fromIntegral . fromFlags) mode)
Graphics/UI/Gtk/OpenGL/Context.chs view
@@ -49,7 +49,7 @@ import Control.Monad (liftM) import System.Glib.FFI-import System.Glib.GObject (makeNewGObject)+import System.Glib.GObject (makeNewGObject, wrapNewGObject) {#import Graphics.UI.Gtk.OpenGL.Types#} {# context lib="gtkglext" prefix="gdk" #}@@ -81,7 +81,7 @@ -- (currently not used). -> IO GLContext glContextNew gldrawable shareList direct renderType =- makeNewGObject mkGLContext $+ wrapNewGObject mkGLContext $ {# call gdk_gl_context_new #} (toGLDrawable gldrawable) (maybe (GLContext nullForeignPtr) toGLContext shareList)
Graphics/UI/Gtk/OpenGL/Pixmap.chs view
@@ -50,7 +50,7 @@ import Control.Monad (liftM) import System.Glib.FFI-import System.Glib.GObject (makeNewGObject)+import System.Glib.GObject (makeNewGObject, wrapNewGObject) {#import Graphics.UI.Gtk.OpenGL.Types#} {# context lib="gtkglext" prefix="gdk" #}@@ -67,7 +67,7 @@ -> Pixmap -- ^ @pixmap@ - the 'Pixmap' to be used as the rendering area. -> IO GLPixmap glPixmapNew glconfig pixmap =- makeNewGObject mkGLPixmap $+ wrapNewGObject mkGLPixmap $ {# call gdk_gl_pixmap_new #} (toGLConfig glconfig) (toPixmap pixmap)
Graphics/UI/Gtk/OpenGL/Window.chs view
@@ -50,7 +50,7 @@ import Control.Monad (liftM) import System.Glib.FFI-import System.Glib.GObject (makeNewGObject)+import System.Glib.GObject (makeNewGObject, wrapNewGObject) {#import Graphics.UI.Gtk.OpenGL.Types#} {# context lib="gtkglext" prefix="gdk" #}@@ -67,7 +67,7 @@ -- area. -> IO GLWindow glWindowNew glconfig window =- makeNewGObject mkGLWindow $+ wrapNewGObject mkGLWindow $ {# call gdk_gl_window_new #} (toGLConfig glconfig) window
Gtk2HsSetup.hs view
@@ -23,16 +23,24 @@ CABAL_VERSION_MICRO) #else #warning Setup.hs is guessing the version of Cabal. If compilation of Setup.hs fails use -DCABAL_VERSION_MINOR=x for Cabal version 1.x.0 when building (prefixed by --ghc-option= when using the 'cabal' command)+#if (__GLASGOW_HASKELL__ >= 700)+#define CABAL_VERSION CABAL_VERSION_ENCODE(1,10,0)+#else #if (__GLASGOW_HASKELL__ >= 612) #define CABAL_VERSION CABAL_VERSION_ENCODE(1,8,0) #else #define CABAL_VERSION CABAL_VERSION_ENCODE(1,6,0) #endif #endif+#endif -- | Build a Gtk2hs package. ---module Gtk2HsSetup ( gtk2hsUserHooks, getPkgConfigPackages ) where+module Gtk2HsSetup ( + gtk2hsUserHooks, + getPkgConfigPackages, + checkGtk2hsBuildtools+ ) where import Distribution.Simple import Distribution.Simple.PreProcess@@ -65,7 +73,7 @@ import Distribution.Simple.Compiler ( Compiler(..) ) import Distribution.Simple.Program ( Program(..), ConfiguredProgram(..),- rawSystemProgramConf, rawSystemProgramStdoutConf,+ rawSystemProgramConf, rawSystemProgramStdoutConf, programName, c2hsProgram, pkgConfigProgram, requireProgram, ghcPkgProgram, simpleProgram, lookupProgram, rawSystemProgramStdout, ProgArg) import Distribution.ModuleName ( ModuleName, components, toFilePath )@@ -83,10 +91,11 @@ #endif import Distribution.Text ( simpleParse, display ) import System.FilePath-import System.Directory ( doesFileExist )+import System.Exit (exitFailure)+import System.Directory ( doesFileExist, getDirectoryContents, doesDirectoryExist ) import Distribution.Version (Version(..)) import Distribution.Verbosity-import Control.Monad (when, unless, filterM)+import Control.Monad (when, unless, filterM, liftM, forM, forM_) import Data.Maybe ( isJust, isNothing, fromMaybe, maybeToList ) import Data.List (isPrefixOf, isSuffixOf, nub) import Data.Char (isAlpha)@@ -94,7 +103,6 @@ import qualified Data.Set as S import Control.Applicative ((<$>))-import System.Directory (getDirectoryContents, doesDirectoryExist) -- the name of the c2hs pre-compiled header file precompFile = "precompchs.bin"@@ -103,13 +111,13 @@ hookedPrograms = [typeGenProgram, signalGenProgram, c2hsLocal], hookedPreProcessors = [("chs", ourC2hs)], confHook = \pd cf ->- confHook simpleUserHooks pd cf >>= return . adjustLocalBuildInfo,+ (fmap adjustLocalBuildInfo (confHook simpleUserHooks pd cf)), postConf = \args cf pd lbi -> do genSynthezisedFiles (fromFlag (configVerbosity cf)) pd lbi postConf simpleUserHooks args cf pd lbi, buildHook = \pd lbi uh bf -> fixDeps pd >>= \pd ->- (buildHook simpleUserHooks) pd lbi uh bf,- copyHook = \pd lbi uh flags -> (copyHook simpleUserHooks) pd lbi uh flags >>+ buildHook simpleUserHooks pd lbi uh bf,+ copyHook = \pd lbi uh flags -> copyHook simpleUserHooks pd lbi uh flags >> installCHI pd lbi (fromFlag (copyVerbosity flags)) (fromFlag (copyDest flags)), instHook = \pd lbi uh flags -> #if defined(mingw32_HOST_OS) || defined(__MINGW32__)@@ -187,7 +195,11 @@ _ | modeGenerateRegFile -> die "Generate Reg File not supported" | modeGenerateRegScript -> die "Generate Reg Script not supported" | otherwise -> registerPackage verbosity+#if CABAL_VERSION_CHECK(1,10,0)+ installedPkgInfo pkg lbi inplace [packageDb]+#else installedPkgInfo pkg lbi inplace packageDb+#endif where modeGenerateRegFile = isJust (flagToMaybe (regGenPkgConf regFlags))@@ -298,7 +310,7 @@ getCppOptions bi lbi = nub $ ["-I" ++ dir | dir <- PD.includeDirs bi]- ++ [opt | opt@('-':c:_) <- (PD.cppOptions bi ++ PD.ccOptions bi), c `elem` "DIU"]+ ++ [opt | opt@('-':c:_) <- PD.cppOptions bi ++ PD.ccOptions bi, c `elem` "DIU"] installCHI :: PackageDescription -- ^information from the .cabal file -> LocalBuildInfo -- ^information from the configure step@@ -308,14 +320,13 @@ let InstallDirs { libdir = libPref } = absoluteInstallDirs pkg lbi copydest -- cannot use the recommended 'findModuleFiles' since it fails if there exists -- a modules that does not have a .chi file- mFiles <- mapM (findFileWithExtension' ["chi"] [buildDir lbi])- (map toFilePath+ mFiles <- mapM (findFileWithExtension' ["chi"] [buildDir lbi] . toFilePath) #if CABAL_VERSION_CHECK(1,8,0) (PD.libModules lib) #else (PD.libModules pkg) #endif- )+ let files = [ f | Just f <- mFiles ] #if CABAL_VERSION_CHECK(1,8,0) installOrdinaryFiles verbosity libPref files@@ -331,13 +342,13 @@ ------------------------------------------------------------------------------ typeGenProgram :: Program-typeGenProgram = (simpleProgram "gtk2hsTypeGen")+typeGenProgram = simpleProgram "gtk2hsTypeGen" signalGenProgram :: Program-signalGenProgram = (simpleProgram "gtk2hsHookGenerator")+signalGenProgram = simpleProgram "gtk2hsHookGenerator" c2hsLocal :: Program-c2hsLocal = (simpleProgram "gtk2hsC2hs")+c2hsLocal = simpleProgram "gtk2hsC2hs" genSynthezisedFiles :: Verbosity -> PackageDescription -> LocalBuildInfo -> IO () genSynthezisedFiles verb pd lbi = do@@ -370,7 +381,7 @@ res <- rawSystemProgramStdoutConf verb prog (withPrograms lbi) args rewriteFile outFile res - (flip mapM_) (filter (\(tag,_) -> "x-types-" `isPrefixOf` tag && "file" `isSuffixOf` tag) xList) $+ forM_ (filter (\(tag,_) -> "x-types-" `isPrefixOf` tag && "file" `isSuffixOf` tag) xList) $ \(fileTag, f) -> do let tag = reverse (drop 4 (reverse fileTag)) info verb ("Ensuring that class hierarchy in "++f++" is up-to-date.")@@ -391,7 +402,7 @@ sequence [ do version <- pkgconfig ["--modversion", display pkgname] case simpleParse version of- Nothing -> die $ "parsing output of pkg-config --modversion failed"+ Nothing -> die "parsing output of pkg-config --modversion failed" Just v -> return (PackageIdentifier pkgname v) | Dependency pkgname _ <- concatMap pkgconfigDepends (allBuildInfo pkg) ] where@@ -456,9 +467,9 @@ extractDeps :: ModDep -> IO ModDep extractDeps md@ModDep { mdLocation = Nothing } = return md extractDeps md@ModDep { mdLocation = Just f } = withUTF8FileContents f $ \con -> do- let findImports acc (('{':'#':xs):xxs) = case (dropWhile ((==) ' ') xs) of+ let findImports acc (('{':'#':xs):xxs) = case (dropWhile (' ' ==) xs) of ('i':'m':'p':'o':'r':'t':' ':ys) ->- case simpleParse (takeWhile ((/=) '#') ys) of+ case simpleParse (takeWhile ('#' /=) ys) of Just m -> findImports (m:acc) xxs Nothing -> die ("cannot parse chs import in "++f++":\n"++ "offending line is {#"++xs)@@ -484,3 +495,17 @@ Just md -> (md:out', visited') where (out',visited') = foldl visit (out, m `S.insert` visited) (mdRequires md)++-- Check user whether install gtk2hs-buildtools correctly.+checkGtk2hsBuildtools :: [String] -> IO ()+checkGtk2hsBuildtools programs = do+ programInfos <- mapM (\ name -> do+ location <- programFindLocation (simpleProgram name) normal+ return (name, location)+ ) programs+ let printError name = do+ putStrLn $ "Cannot find " ++ name ++ "\n" + ++ "Please install `gtk2hs-buildtools` first and check that the install directory is in your PATH (e.g. HOME/.cabal/bin)."+ exitFailure+ forM_ programInfos $ \ (name, location) ->+ when (isNothing location) (printError name)
Setup.hs view
@@ -1,7 +1,10 @@ -- Setup file for a Gtk2Hs module. Contains only adjustments specific to this module, -- all Gtk2Hs-specific boilerplate is stored in Gtk2HsSetup.hs which should be kept -- identical across all modules.-import Gtk2HsSetup ( gtk2hsUserHooks )+import Gtk2HsSetup ( gtk2hsUserHooks, checkGtk2hsBuildtools ) import Distribution.Simple ( defaultMainWithHooks ) -main = defaultMainWithHooks gtk2hsUserHooks+main = do+ checkGtk2hsBuildtools ["gtk2hsC2hs", "gtk2hsTypeGen", "gtk2hsHookGenerator"]+ defaultMainWithHooks gtk2hsUserHooks+
demo/RotatingCube.hs view
@@ -9,9 +9,9 @@ import Graphics.Rendering.OpenGL as GL main :: IO ()-main = do +main = do Gtk.initGUI- + -- Initialise the Gtk+ OpenGL extension -- (including reading various command line parameters) GtkGL.initGL@@ -21,10 +21,10 @@ glconfig <- GtkGL.glConfigNew [GtkGL.GLModeRGBA, GtkGL.GLModeDepth, GtkGL.GLModeDouble]- + -- Create an OpenGL drawing area widget canvas <- GtkGL.glDrawingAreaNew glconfig- + Gtk.widgetSetSizeRequest canvas 350 350 -- Initialise some GL setting just before the canvas first gets shown@@ -69,7 +69,7 @@ label <- Gtk.labelNew (Just "Gtk2Hs using OpenGL via HOpenGL!") button <- Gtk.buttonNewWithLabel "Close"- Gtk.onClicked button (do + Gtk.onClicked button (do Gtk.widgetDestroy window Gtk.mainQuit) Gtk.set vbox [ Gtk.containerChild := canvas,
gtkglext.cabal view
@@ -1,5 +1,5 @@ Name: gtkglext-Version: 0.11.1+Version: 0.12.0 License: LGPL-2.1 License-file: COPYING Copyright: (c) 2001-2010 The Gtk2Hs Team@@ -35,10 +35,10 @@ Library build-depends: base >= 4 && < 5, array, containers, haskell98, mtl,- glib >= 0.11 && < 0.12, - pango >= 0.11 && < 0.12, - cairo >= 0.11 && < 0.12,- gtk >= 0.11 && < 0.12+ glib >= 0.12 && < 0.13, + pango >= 0.12 && < 0.13, + cairo >= 0.12 && < 0.13,+ gtk >= 0.12 && < 0.13 build-tools: gtk2hsC2hs, gtk2hsHookGenerator, gtk2hsTypeGen