internal/goglfw: fix _GET_X_LPARAM and _GET_Y_LPARAM from api_windows.go (#2665)

Negative values should not disappear. For example, if _HIWORD returns 63000,
then _GET_Y_LPARAM should return -2536, but now it returns 63000.

This fixes that.
This commit is contained in:
the-goodies 2023-05-10 03:27:40 +03:00 committed by GitHub
parent 50b68a0427
commit 12a179aab9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -367,7 +367,7 @@ type (
) )
func _GET_X_LPARAM(lp _LPARAM) int { func _GET_X_LPARAM(lp _LPARAM) int {
return int(_LOWORD(uint32(lp))) return int(int16(_LOWORD(uint32(lp))))
} }
func _GET_XBUTTON_WPARAM(wParam _WPARAM) uint16 { func _GET_XBUTTON_WPARAM(wParam _WPARAM) uint16 {
@ -375,7 +375,7 @@ func _GET_XBUTTON_WPARAM(wParam _WPARAM) uint16 {
} }
func _GET_Y_LPARAM(lp _LPARAM) int { func _GET_Y_LPARAM(lp _LPARAM) int {
return int(_HIWORD(uint32(lp))) return int(int16(_HIWORD(uint32(lp))))
} }
func _HIWORD(dwValue uint32) uint16 { func _HIWORD(dwValue uint32) uint16 {