From 546417d15ddc8cf9b59827c202360919a34a8785 Mon Sep 17 00:00:00 2001 From: nek0 Date: Fri, 8 Feb 2019 09:19:24 +0100 Subject: [PATCH] change switch key binding and add fullscreen key binding --- src/Events.hs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/Events.hs b/src/Events.hs index fc86bf1..c9ec694 100644 --- a/src/Events.hs +++ b/src/Events.hs @@ -31,7 +31,7 @@ handlePayload run state (SDL.KeyboardEvent (SDL.KeyboardEventData _ SDL.Pressed | SDL.keysymKeycode sym == SDL.KeycodeEscape = do _ <- swapMVar run False return () - | SDL.keysymKeycode sym == SDL.KeycodeF12 || SDL.keysymKeycode sym == SDL.KeycodeF = + | SDL.keysymKeycode sym == SDL.KeycodeF8 = modifyMVar_ state $ \st -> do let st2 = st { stPresentationWindow = @@ -47,6 +47,14 @@ handlePayload run state (SDL.KeyboardEvent (SDL.KeyboardEventData _ SDL.Pressed ) (stWindows st2) return st2 + | SDL.keysymKeycode sym == SDL.KeycodeF11 = do + st <- readMVar state + wc <- SDL.getWindowConfig (snd $ head $ stWindows st) + case SDL.windowMode wc of + SDL.Windowed -> + mapM_ (flip SDL.setWindowMode SDL.FullscreenDesktop . snd) (stWindows st) + _ -> + mapM_ (flip SDL.setWindowMode SDL.Windowed . snd) (stWindows st) -- catch all other events handlePayload _ _ _ = return ()