 shuffle windows.user32 windows.messages sequences combinators
 math.geometry.rect ui.windows accessors math windows alien
 alien.strings io.encodings.utf16 continuations byte-arrays
-locals ;
+locals game-input.backend.dinput.keys-array ;
 IN: game-input.backend.dinput
 
 SINGLETON: dinput-game-input-backend
 
-SYMBOLS: +dinput+ +keyboard-device+
+SYMBOLS: +dinput+ +keyboard-device+ +keyboard-state+
     +controller-devices+ +controller-guids+
     +device-change-window+ +device-change-handle+ ;
 

: find-keyboard ( -- )
    GUID_SysKeyboard device-for-guid
    [ configure-keyboard ]
    [ +keyboard-device+ set-global ] bi ;

: device-info ( device -- DIDEVICEIMAGEINFOW )
    "DIDEVICEINSTANCEW" <c-object>


: release-keyboard ( -- )
    +keyboard-device+ global
    [ com-release f ] change-at
    f +keyboard-state+ set-global ;

M: dinput-game-input-backend (open-game-input)
    create-dinput
