sys/windows: add several procedures and macros

This commit is contained in:
hikari
2022-04-02 08:23:12 +03:00
parent 850d4a1e1b
commit 4c14e92952
2 changed files with 38 additions and 2 deletions
+17
View File
@@ -707,6 +707,23 @@ MK_MBUTTON :: 0x0010
MK_XBUTTON1 :: 0x0020
MK_XBUTTON2 :: 0x0040
// Value for rolling one detent
WHEEL_DELTA :: 120
// Setting to scroll one page for SPI_GET/SETWHEELSCROLLLINES
WHEEL_PAGESCROLL :: max(UINT)
// XButton values are WORD flags
XBUTTON1 :: 0x0001
XBUTTON2 :: 0x0002
// Were there to be an XBUTTON3, its value would be 0x0004
MAPVK_VK_TO_VSC :: 0
MAPVK_VSC_TO_VK :: 1
MAPVK_VK_TO_CHAR :: 2
MAPVK_VSC_TO_VK_EX :: 3
MAPVK_VK_TO_VSC_EX :: 4
TME_HOVER :: 0x00000001
TME_LEAVE :: 0x00000002
TME_NONCLIENT :: 0x00000010
+21 -2
View File
@@ -131,6 +131,9 @@ foreign user32 {
GetKeyState :: proc(nVirtKey: c_int) -> SHORT ---
GetAsyncKeyState :: proc(vKey: c_int) -> SHORT ---
MapVirtualKeyA :: proc(uCode: UINT, uMapType: UINT) -> UINT ---
MapVirtualKeyW :: proc(uCode: UINT, uMapType: UINT) -> UINT ---
SetWindowsHookExA :: proc(idHook: c_int, lpfn: HOOKPROC, hmod: HINSTANCE, dwThreadId: DWORD) -> HHOOK ---
SetWindowsHookExW :: proc(idHook: c_int, lpfn: HOOKPROC, hmod: HINSTANCE, dwThreadId: DWORD) -> HHOOK ---
UnhookWindowsHookEx :: proc(hhk: HHOOK) -> BOOL ---
@@ -228,6 +231,22 @@ when ODIN_ARCH == .amd64 {
SetWindowLongPtrW :: GetWindowLongW
}
GET_SC_WPARAM :: #force_inline proc(wparam: WPARAM) -> i32 {
return i32(wparam) & 0xFFF0
GET_SC_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> c_int {
return c_int(wParam) & 0xFFF0
}
GET_WHEEL_DELTA_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> c_short {
return cast(c_short)HIWORD(cast(DWORD)wParam)
}
GET_KEYSTATE_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> WORD {
return LOWORD(cast(DWORD)wParam)
}
GET_NCHITTEST_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> c_short {
return cast(c_short)LOWORD(cast(DWORD)wParam)
}
GET_XBUTTON_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> WORD {
return HIWORD(cast(DWORD)wParam)
}