change switch key binding and add fullscreen key binding

This commit is contained in:
nek0 2019-02-08 09:19:24 +01:00
parent cda7bfd068
commit 546417d15d

View file

@ -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 ()