mirror of
https://github.com/odin-lang/Odin.git
synced 2026-06-04 09:44:40 +00:00
sys/windows: fix some procedure definitions and types
This commit is contained in:
@@ -395,13 +395,6 @@ CS_BYTEALIGNWINDOW : UINT : 0x2000
|
||||
CS_GLOBALCLASS : UINT : 0x4000
|
||||
CS_DROPSHADOW : UINT : 0x0002_0000
|
||||
|
||||
GWL_EXSTYLE : c_int : -20
|
||||
GWLP_HINSTANCE : c_int : -6
|
||||
GWLP_ID : c_int : -12
|
||||
GWL_STYLE : c_int : -16
|
||||
GWLP_USERDATA : c_int : -21
|
||||
GWLP_WNDPROC : c_int : -4
|
||||
|
||||
WS_BORDER : UINT : 0x0080_0000
|
||||
WS_CAPTION : UINT : 0x00C0_0000
|
||||
WS_CHILD : UINT : 0x4000_0000
|
||||
@@ -493,6 +486,48 @@ HWND_BOTTOM :: HWND( uintptr(1)) // 1
|
||||
HWND_TOPMOST :: HWND(~uintptr(0)) // -1
|
||||
HWND_NOTOPMOST :: HWND(~uintptr(0) - 1) // -2
|
||||
|
||||
// Window field offsets for GetWindowLong()
|
||||
GWL_STYLE :: -16
|
||||
GWL_EXSTYLE :: -20
|
||||
GWL_ID :: -12
|
||||
|
||||
when ODIN_ARCH == .i386 {
|
||||
GWL_WNDPROC :: -4
|
||||
GWL_HINSTANCE :: -6
|
||||
GWL_HWNDPARENT :: -8
|
||||
GWL_USERDATA :: -21
|
||||
}
|
||||
|
||||
GWLP_WNDPROC :: -4
|
||||
GWLP_HINSTANCE :: -6
|
||||
GWLP_HWNDPARENT :: -8
|
||||
GWLP_USERDATA :: -21
|
||||
GWLP_ID :: -12
|
||||
|
||||
// Class field offsets for GetClassLong()
|
||||
GCL_CBWNDEXTRA :: -18
|
||||
GCL_CBCLSEXTRA :: -20
|
||||
GCL_STYLE :: -26
|
||||
GCW_ATOM :: -32
|
||||
|
||||
when ODIN_ARCH == .i386 {
|
||||
GCL_MENUNAME :: -8
|
||||
GCL_HBRBACKGROUND :: -10
|
||||
GCL_HCURSOR :: -12
|
||||
GCL_HICON :: -14
|
||||
GCL_HMODULE :: -16
|
||||
GCL_WNDPROC :: -24
|
||||
GCL_HICONSM :: -34
|
||||
}
|
||||
|
||||
GCLP_MENUNAME :: -8
|
||||
GCLP_HBRBACKGROUND :: -10
|
||||
GCLP_HCURSOR :: -12
|
||||
GCLP_HICON :: -14
|
||||
GCLP_HMODULE :: -16
|
||||
GCLP_WNDPROC :: -24
|
||||
GCLP_HICONSM :: -34
|
||||
|
||||
// GetSystemMetrics() codes
|
||||
SM_CXSCREEN :: 0
|
||||
SM_CYSCREEN :: 1
|
||||
|
||||
@@ -10,19 +10,19 @@ foreign user32 {
|
||||
GetClassInfoExA :: proc(hInsatnce: HINSTANCE, lpszClass: LPCSTR, lpwcx: ^WNDCLASSEXA) -> BOOL ---
|
||||
GetClassInfoExW :: proc(hInsatnce: HINSTANCE, lpszClass: LPCWSTR, lpwcx: ^WNDCLASSEXW) -> BOOL ---
|
||||
|
||||
GetClassLongPtrA :: proc(hWnd: HWND, nIndex: c_int) -> DWORD ---
|
||||
GetClassLongPtrW :: proc(hWnd: HWND, nIndex: c_int) -> DWORD ---
|
||||
SetClassLongPtrA :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> ULONG_PTR ---
|
||||
SetClassLongPtrW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> ULONG_PTR ---
|
||||
GetClassLongA :: proc(hWnd: HWND, nIndex: c_int) -> DWORD ---
|
||||
GetClassLongW :: proc(hWnd: HWND, nIndex: c_int) -> DWORD ---
|
||||
SetClassLongA :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG) -> DWORD ---
|
||||
SetClassLongW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG) -> DWORD ---
|
||||
|
||||
GetWindowLongA :: proc(hWnd: HWND, nIndex: c_int) -> LONG ---
|
||||
GetWindowLongW :: proc(hWnd: HWND, nIndex: c_int) -> LONG ---
|
||||
SetWindowLongA :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG) -> LONG ---
|
||||
SetWindowLongW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG) -> LONG ---
|
||||
|
||||
GetClassNameA :: proc(hWnd: HWND, lpClassName: LPSTR, nMaxCount: c_int) -> c_int ---
|
||||
GetClassNameW :: proc(hWnd: HWND, lpClassName: LPWSTR, nMaxCount: c_int) -> c_int ---
|
||||
|
||||
GetWindowLongPtrA :: proc(hWnd: HWND, nIndex: c_int) -> LONG_PTR ---
|
||||
GetWindowLongPtrW :: proc(hWnd: HWND, nIndex: c_int) -> LONG_PTR ---
|
||||
SetWindowLongPtrA :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> LONG_PTR ---
|
||||
SetWindowLongPtrW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> LONG_PTR ---
|
||||
|
||||
RegisterClassA :: proc(lpWndClass: ^WNDCLASSA) -> ATOM ---
|
||||
RegisterClassW :: proc(lpWndClass: ^WNDCLASSW) -> ATOM ---
|
||||
RegisterClassExA :: proc(^WNDCLASSEXA) -> ATOM ---
|
||||
@@ -198,6 +198,31 @@ CreateWindowW :: #force_inline proc "stdcall" (
|
||||
)
|
||||
}
|
||||
|
||||
when ODIN_ARCH == .amd64 {
|
||||
@(default_calling_convention="stdcall")
|
||||
foreign user32 {
|
||||
GetClassLongPtrA :: proc(hWnd: HWND, nIndex: c_int) -> ULONG_PTR ---
|
||||
GetClassLongPtrW :: proc(hWnd: HWND, nIndex: c_int) -> ULONG_PTR ---
|
||||
SetClassLongPtrA :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> ULONG_PTR ---
|
||||
SetClassLongPtrW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> ULONG_PTR ---
|
||||
|
||||
GetWindowLongPtrA :: proc(hWnd: HWND, nIndex: c_int) -> LONG_PTR ---
|
||||
GetWindowLongPtrW :: proc(hWnd: HWND, nIndex: c_int) -> LONG_PTR ---
|
||||
SetWindowLongPtrA :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> LONG_PTR ---
|
||||
SetWindowLongPtrW :: proc(hWnd: HWND, nIndex: c_int, dwNewLong: LONG_PTR) -> LONG_PTR ---
|
||||
}
|
||||
} else when ODIN_ARCH == .i386 {
|
||||
GetClassLongPtrA :: GetClassLongA
|
||||
GetClassLongPtrW :: GetClassLongW
|
||||
SetClassLongPtrA :: SetClassLongA
|
||||
SetClassLongPtrW :: SetClassLongW
|
||||
|
||||
GetWindowLongPtrA :: GetWindowLongA
|
||||
GetWindowLongPtrW :: GetWindowLongW
|
||||
SetWindowLongPtrA :: GetWindowLongA
|
||||
SetWindowLongPtrW :: GetWindowLongW
|
||||
}
|
||||
|
||||
GET_SC_WPARAM :: #force_inline proc(wparam: WPARAM) -> i32 {
|
||||
return i32(wparam) & 0xFFF0
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user