diff --git a/core/sys/windows/user32.odin b/core/sys/windows/user32.odin index f137dc22c..75ed1e91b 100644 --- a/core/sys/windows/user32.odin +++ b/core/sys/windows/user32.odin @@ -347,6 +347,10 @@ foreign user32 { GetScrollInfo :: proc(hwnd: HWND, nBar: c_int, lpsi: ^SCROLLINFO) -> BOOL --- ShowScrollBar :: proc(hwnd: HWND, nBar: c_int, bShow: BOOL) -> BOOL --- EnableScrollBar :: proc(hwnd: HWND, wSBflags: UINT, wArrows: UINT) -> BOOL --- + + EnableMouseInPointer :: proc(fEnable: BOOL) --- + GetPointerInfo :: proc(pointerId: UINT, pointerInfo: ^POINTER_INFO) -> BOOL --- + GetPointerPenInfo :: proc(pointerId: UINT, penInfo: ^POINTER_PEN_INFO) -> BOOL --- } CreateWindowW :: #force_inline proc "system" ( @@ -971,6 +975,97 @@ ESB_DISABLE_DOWN :: 0x0002 ESB_DISABLE_LTUP :: ESB_DISABLE_LEFT ESB_DISABLE_RTDN :: ESB_DISABLE_RIGHT +POINTER_INPUT_TYPE :: enum DWORD { + PT_POINTER = 1, + PT_TOUCH = 2, + PT_PEN = 3, + PT_MOUSE = 4, + PT_TOUCHPAD = 5, +} + +POINTER_BUTTON_CHANGE_TYPE :: enum { + NONE, + FIRSTBUTTON_DOWN, + FIRSTBUTTON_UP, + SECONDBUTTON_DOWN, + SECONDBUTTON_UP, + THIRDBUTTON_DOWN, + THIRDBUTTON_UP, + FOURTHBUTTON_DOWN, + FOURTHBUTTON_UP, + FIFTHBUTTON_DOWN, + FIFTHBUTTON_UP, +} + +PointerFlag :: enum { + new = 0, + in_range = 1, + in_contact = 2, + first_button = 4, + second_button = 5, + third_button = 6, + fourth_button = 7, + fifth_button = 8, + primary = 13, + confidence = 14, + canceled = 15, + down = 16, + update = 17, + up = 18, + wheel = 19, + hwheel = 20, + capture_changed = 21, + has_transform = 22, +} + +PenFlag :: enum { + barrel = 0, + inverted = 1, + eraser = 2, +} + +PenMask :: enum { + pressure = 0, + rotation = 1, + tiltX = 2, + tiltY = 3, +} + +POINTER_INFO :: struct { + pointerType: POINTER_INPUT_TYPE, + pointerId: UINT, + frameId: UINT, + pointerFlags: bit_set[PointerFlag; UINT], + sourceDevice: HANDLE, + hwndTarget: HWND, + ptPixelLocation: POINT, + ptHimetricLocation: POINT, + ptPixelLocationRaw: POINT, + ptHimetricLocationRaw: POINT, + dwTime: DWORD, + historyCount: UINT, + InputData: INT32, + dwKeyStates: DWORD, + PerformanceCount: UINT, + ButtonChangeType: POINTER_BUTTON_CHANGE_TYPE, +} + +POINTER_PEN_INFO :: struct { + pointerInfo: POINTER_INFO, + penFlags: bit_set[PenFlag; UINT], + penMask: bit_set[PenMask; UINT], + + // pressure normalized to a range between 0 and 1024. 0 if the device does not report pressure. + pressure: UINT, + + // clockwise rotation, or twist, of the pointer normalized in a range of 0 to 359 + rotation: UINT, + + // -90 to +90; positive value indicating a tilt toward the user + tiltX: INT, + tiltY: INT, +} + // Command constants for GetWindow GW_HWNDFIRST :: 0 GW_HWNDLAST :: 1