mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Merge pull request #4038 from Hyrtwol/core-sys-windows-rawinput-code
Core sys windows rawinput code
This commit is contained in:
@@ -373,8 +373,9 @@ GET_XBUTTON_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> WORD
|
|||||||
return HIWORD(cast(DWORD)wParam)
|
return HIWORD(cast(DWORD)wParam)
|
||||||
}
|
}
|
||||||
|
|
||||||
GET_RAWINPUT_CODE_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> BYTE {
|
// Retrieves the input code from wParam in WM_INPUT message.
|
||||||
return BYTE(wParam) & 0xFF
|
GET_RAWINPUT_CODE_WPARAM :: #force_inline proc "contextless" (wParam: WPARAM) -> RAWINPUT_CODE {
|
||||||
|
return RAWINPUT_CODE(wParam & 0xFF)
|
||||||
}
|
}
|
||||||
|
|
||||||
MAKEINTRESOURCEW :: #force_inline proc "contextless" (#any_int i: int) -> LPWSTR {
|
MAKEINTRESOURCEW :: #force_inline proc "contextless" (#any_int i: int) -> LPWSTR {
|
||||||
@@ -398,6 +399,16 @@ DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE :: DPI_AWARENESS_CONTEXT(~uintptr(2))
|
|||||||
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 :: DPI_AWARENESS_CONTEXT(~uintptr(3)) // -4
|
DPI_AWARENESS_CONTEXT_PER_MONITOR_AWARE_V2 :: DPI_AWARENESS_CONTEXT(~uintptr(3)) // -4
|
||||||
DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED :: DPI_AWARENESS_CONTEXT(~uintptr(4)) // -5
|
DPI_AWARENESS_CONTEXT_UNAWARE_GDISCALED :: DPI_AWARENESS_CONTEXT(~uintptr(4)) // -5
|
||||||
|
|
||||||
|
RAWINPUT_CODE :: enum {
|
||||||
|
// The input is in the regular message flow,
|
||||||
|
// the app is required to call DefWindowProc
|
||||||
|
// so that the system can perform clean ups.
|
||||||
|
RIM_INPUT = 0,
|
||||||
|
// The input is sink only. The app is expected
|
||||||
|
// to behave nicely.
|
||||||
|
RIM_INPUTSINK = 1,
|
||||||
|
}
|
||||||
|
|
||||||
RAWINPUTHEADER :: struct {
|
RAWINPUTHEADER :: struct {
|
||||||
dwType: DWORD,
|
dwType: DWORD,
|
||||||
dwSize: DWORD,
|
dwSize: DWORD,
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
//+build windows
|
||||||
|
package test_core_sys_windows
|
||||||
|
|
||||||
|
import "core:testing"
|
||||||
|
import win32 "core:sys/windows"
|
||||||
|
|
||||||
|
@(test)
|
||||||
|
verify_rawinput_code :: proc(t: ^testing.T) {
|
||||||
|
testing.expect_value(t, win32.GET_RAWINPUT_CODE_WPARAM(0), win32.RAWINPUT_CODE.RIM_INPUT)
|
||||||
|
testing.expect_value(t, win32.GET_RAWINPUT_CODE_WPARAM(1), win32.RAWINPUT_CODE.RIM_INPUTSINK)
|
||||||
|
testing.expect_value(t, win32.GET_RAWINPUT_CODE_WPARAM(0x100), win32.RAWINPUT_CODE.RIM_INPUT)
|
||||||
|
testing.expect_value(t, win32.GET_RAWINPUT_CODE_WPARAM(0x101), win32.RAWINPUT_CODE.RIM_INPUTSINK)
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user