fix dinput device hotplug support
parent
eeebf6c751
commit
4758cca223
|
@ -160,19 +160,24 @@ SYMBOLS: +dinput+ +keyboard-device+ +keyboard-state+
|
||||||
[ device-attached? not ] filter
|
[ device-attached? not ] filter
|
||||||
[ remove-controller ] each ;
|
[ remove-controller ] each ;
|
||||||
|
|
||||||
: device-interface? ( dbt-broadcast-hdr -- ? )
|
: ?device-interface ( dbt-broadcast-hdr -- ? )
|
||||||
dbch_devicetype>> DBT_DEVTYP_DEVICEINTERFACE = ;
|
dup dbch_devicetype>> DBT_DEVTYP_DEVICEINTERFACE =
|
||||||
|
[ >c-ptr DEV_BROADCAST_DEVICEW memory>struct ]
|
||||||
|
[ drop f ] if ; inline
|
||||||
|
|
||||||
: device-arrived ( dbt-broadcast-hdr -- )
|
: device-arrived ( dbt-broadcast-hdr -- )
|
||||||
device-interface? [ find-controllers ] when ;
|
?device-interface [ find-controllers ] when ; inline
|
||||||
|
|
||||||
: device-removed ( dbt-broadcast-hdr -- )
|
: device-removed ( dbt-broadcast-hdr -- )
|
||||||
device-interface? [ find-and-remove-detached-devices ] when ;
|
?device-interface [ find-and-remove-detached-devices ] when ; inline
|
||||||
|
|
||||||
|
: <DEV_BROADCAST_HDR> ( wParam -- struct )
|
||||||
|
<alien> DEV_BROADCAST_HDR memory>struct ;
|
||||||
|
|
||||||
: handle-wm-devicechange ( hWnd uMsg wParam lParam -- )
|
: handle-wm-devicechange ( hWnd uMsg wParam lParam -- )
|
||||||
[ 2drop ] 2dip swap {
|
[ 2drop ] 2dip swap {
|
||||||
{ [ dup DBT_DEVICEARRIVAL = ] [ drop <alien> device-arrived ] }
|
{ [ dup DBT_DEVICEARRIVAL = ] [ drop <DEV_BROADCAST_HDR> device-arrived ] }
|
||||||
{ [ dup DBT_DEVICEREMOVECOMPLETE = ] [ drop <alien> device-removed ] }
|
{ [ dup DBT_DEVICEREMOVECOMPLETE = ] [ drop <DEV_BROADCAST_HDR> device-removed ] }
|
||||||
[ 2drop ]
|
[ 2drop ]
|
||||||
} cond ;
|
} cond ;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue