module Graphics.Window.Event.FromRaw
import Graphics.Window.Event
import Winit.FFI
import System.FFI
WindowEventBody_ActivationTokenDone : Type
WindowEventBody_ActivationTokenDone = Struct "ActivationTokenDone" [ ("a", AsyncRequestSerial), ("b", ActivationToken) ]
export
windowEvent : RawWindowEvent -> WindowEvent.T
windowEvent event =
case tag of
ActivationTokenDone => ActivationTokenDone
SurfaceResized => SurfaceResized <| bodySurfaceResize
Moved => Moved
CloseRequested => CloseRequested
Destroyed => Destroyed
DragEntered => DragEntered
DragMoved => DragMoved
DragDropped => DragDropped
DragLeft => DragLeft
Focused => Focused
KeyboardInput => KeyboardInput
ModifiersChanged => ModifiersChanged
Ime => Ime
PointerMoved => PointerMoved
PointerEntered => PointerEntered
PointerLeft => PointerLeft
MouseWheel => MouseWheel
PointerButton => PointerButton
PinchGesture => PinchGesture
PanGesture => PanGesture
DoubleTapGesture => DoubleTapGesture
RotationGesture => RotationGesture
TouchpadPressure => TouchpadPressure
ScaleFactorChanged => ScaleFactorChanged
ThemeChanged => ThemeChanged
Occluded => Occluded
RedrawRequested => RedrawRequested
where
tag = FFI.windowEventKind event
body = FFI.windowEventBody event
bodySurfaceResize =
let
typedBody : WindowEventBody_SurfaceResize
typedBody = believe_me body
aVal : Bits32
aVal = getField typedBody "a"
bVal : Bits32
bVal = getField typedBody "b"
in
MkPhysicalSize aVal bVal