wm-handlers [
H{
${ WM_CLOSE [ handle-wm-close 0 ] }
+ ! ${ WM_NCCREATE [ [ 3drop EnableNonClientDpiScaling drop ] [ DefWindowProc ] 4bi ] }
+ ! ${ WM_GETDPISCALEDSIZE [ DefWindowProc ] }
+ ! ${ WM_DPICHANGED [ DefWindowProc ] }
${ WM_PAINT [ 4dup handle-wm-paint DefWindowProc ] }
${ WM_SIZE [ handle-wm-size 0 ] }
] [ drop ] if ;
: adjust-RECT ( RECT style ex-style -- )
+ ! [ 0 ] dip GetDpiForSystem AdjustWindowRectExForDpi win32-error=0/f ;
[ 0 ] dip AdjustWindowRectEx win32-error=0/f ;
: make-RECT ( world -- RECT )
dup
] change-global ;
+: get-device-caps ( handle -- x y )
+ GetDC
+ [ LOGPIXELSX GetDeviceCaps ]
+ [ LOGPIXELSY GetDeviceCaps ] bi ;
+
+: get-default-device-caps ( -- x y )
+ f get-device-caps ;
+
:: create-window ( rect style ex-style -- hwnd )
rect style ex-style make-adjusted-RECT
[ get-window-class f ] dip