diff --git a/ibis.cabal b/ibis.cabal index 03d4db0..9ea0f84 100644 --- a/ibis.cabal +++ b/ibis.cabal @@ -31,7 +31,6 @@ executable ibis , monad-loops , OpenGL , text - , nanovg , magic , split , time diff --git a/shell.nix b/shell.nix index 843268c..40feffb 100644 --- a/shell.nix +++ b/shell.nix @@ -22,12 +22,14 @@ let doCheck = false; description = "Both high- and low-level bindings to the SDL library (version 2.0.4+)."; license = stdenv.lib.licenses.bsd3; + enableLibraryProfiling = true; + enableExecutableProfiling = true; }) {}; inherit (nixpkgs) pkgs; - f = { mkDerivation, base, linear, monad-loops, optparse-applicative, OpenGL, - poppler, stdenv, text + f = { mkDerivation, base, containers, linear, magic, monad-loops, + optparse-applicative, OpenGL, poppler, split, stdenv, text, time }: mkDerivation { pname = "ibis"; @@ -35,8 +37,8 @@ let src = ./.; isLibrary = false; isExecutable = true; - executableHaskellDepends = [ base linear sdl2 monad-loops - OpenGL optparse-applicative poppler text ]; + executableHaskellDepends = [ base containers linear sdl2 magic + monad-loops OpenGL optparse-applicative poppler split text time ]; description = "A pdf presenter"; license = stdenv.lib.licenses.gpl3; }; diff --git a/src/Main.hs b/src/Main.hs index a46a59e..45a44f4 100644 --- a/src/Main.hs +++ b/src/Main.hs @@ -4,10 +4,11 @@ module Main where import qualified SDL import qualified SDL.Raw.Video as SDL (glSetAttribute) import qualified SDL.Raw.Enum as SDL +import qualified SDL.Raw.Basic as SDL import qualified Graphics.Rendering.OpenGL as GL (clear, flush, ClearBuffer(..)) -import qualified NanoVG as NVG +-- import qualified NanoVG as NVG import Linear @@ -30,6 +31,8 @@ import Data.Time.Clock import System.Exit (exitFailure) +import Foreign.C.String + import Magic -- internal imports @@ -59,6 +62,9 @@ main = do verb opts ("Passed command line options: " ++ show opts) -- set Render quality SDL.HintRenderScaleQuality SDL.$= SDL.ScaleLinear + uncurry SDL.setHint =<< (,) + <$> newCString "SDL_HINT_VIDEO_MINIMIZE_ON_FOCUS_LOSS" + <*> newCString "0" -- check render quality renderQuality <- SDL.get SDL.HintRenderScaleQuality when (renderQuality /= SDL.ScaleLinear) $ @@ -83,9 +89,9 @@ main = do void $ SDL.glSetAttribute SDL.SDL_GL_SHARE_WITH_CURRENT_CONTEXT 1 verb opts "Creating OpenGL context(s)" contexts <- zip (map fst wins) <$> mapM (SDL.glCreateContext . snd) wins - verb opts "Creating NanoVG context" - _ <- glewInit - nano <- NVG.createGL3 (S.fromList [NVG.Antialias, NVG.StencilStrokes]) + -- verb opts "Creating NanoVG context" + -- _ <- glewInit + -- nano <- NVG.createGL3 (S.fromList [NVG.Antialias, NVG.StencilStrokes]) verb opts "Initializing state" state <- newMVar <$> ( State <$> diff --git a/src/Util.hs b/src/Util.hs index 97adcd4..e7b06be 100644 --- a/src/Util.hs +++ b/src/Util.hs @@ -1,4 +1,4 @@ -{-# LANGUAGE ForeignFunctionInterface #-} +-- {-# LANGUAGE ForeignFunctionInterface #-} module Util where import qualified SDL hiding (V2) @@ -21,8 +21,8 @@ import Linear import Types -foreign import ccall unsafe "glewInit" - glewInit :: IO CInt +-- foreign import ccall unsafe "glewInit" +-- glewInit :: IO CInt glWindowConfig :: SDL.WindowConfig glWindowConfig = SDL.defaultWindow