mirror of
https://git.sr.ht/~eliasnaur/gio
synced 2026-07-05 17:35:36 +00:00
app/internal/windows: don't crash on app.Fullscreen on windows/386
Before this patch, use of `app.Fullscreen` would result in "Failed to find SetWindowLongPtrW procedure in user32.dll" when running on 32 bit Windows. Signed-off-by: Inkeliz <inkeliz@inkeliz.com>
This commit is contained in:
@@ -268,6 +268,7 @@ var (
|
|||||||
_GetMessageTime = user32.NewProc("GetMessageTime")
|
_GetMessageTime = user32.NewProc("GetMessageTime")
|
||||||
_GetMonitorInfo = user32.NewProc("GetMonitorInfoW")
|
_GetMonitorInfo = user32.NewProc("GetMonitorInfoW")
|
||||||
_GetWindowLong = user32.NewProc("GetWindowLongPtrW")
|
_GetWindowLong = user32.NewProc("GetWindowLongPtrW")
|
||||||
|
_GetWindowLong32 = user32.NewProc("GetWindowLongW")
|
||||||
_GetWindowPlacement = user32.NewProc("GetWindowPlacement")
|
_GetWindowPlacement = user32.NewProc("GetWindowPlacement")
|
||||||
_KillTimer = user32.NewProc("KillTimer")
|
_KillTimer = user32.NewProc("KillTimer")
|
||||||
_LoadCursor = user32.NewProc("LoadCursorW")
|
_LoadCursor = user32.NewProc("LoadCursorW")
|
||||||
@@ -293,6 +294,7 @@ var (
|
|||||||
_SetProcessDPIAware = user32.NewProc("SetProcessDPIAware")
|
_SetProcessDPIAware = user32.NewProc("SetProcessDPIAware")
|
||||||
_SetTimer = user32.NewProc("SetTimer")
|
_SetTimer = user32.NewProc("SetTimer")
|
||||||
_SetWindowLong = user32.NewProc("SetWindowLongPtrW")
|
_SetWindowLong = user32.NewProc("SetWindowLongPtrW")
|
||||||
|
_SetWindowLong32 = user32.NewProc("SetWindowLongW")
|
||||||
_SetWindowPlacement = user32.NewProc("SetWindowPlacement")
|
_SetWindowPlacement = user32.NewProc("SetWindowPlacement")
|
||||||
_SetWindowPos = user32.NewProc("SetWindowPos")
|
_SetWindowPos = user32.NewProc("SetWindowPos")
|
||||||
_SetWindowText = user32.NewProc("SetWindowTextW")
|
_SetWindowText = user32.NewProc("SetWindowTextW")
|
||||||
@@ -471,12 +473,20 @@ func GetMonitorInfo(hwnd syscall.Handle) MonitorInfo {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetWindowLong(hwnd syscall.Handle) (style uintptr) {
|
func GetWindowLong(hwnd syscall.Handle) (style uintptr) {
|
||||||
style, _, _ = _GetWindowLong.Call(uintptr(hwnd), uintptr(GWL_STYLE))
|
if runtime.GOARCH == "386" {
|
||||||
|
style, _, _ = _GetWindowLong32.Call(uintptr(hwnd), uintptr(GWL_STYLE))
|
||||||
|
} else {
|
||||||
|
style, _, _ = _GetWindowLong.Call(uintptr(hwnd), uintptr(GWL_STYLE))
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetWindowLong(hwnd syscall.Handle, idx uint32, style uintptr) {
|
func SetWindowLong(hwnd syscall.Handle, idx uint32, style uintptr) {
|
||||||
_SetWindowLong.Call(uintptr(hwnd), uintptr(idx), style)
|
if runtime.GOARCH == "386" {
|
||||||
|
_SetWindowLong32.Call(uintptr(hwnd), uintptr(idx), style)
|
||||||
|
} else {
|
||||||
|
_SetWindowLong.Call(uintptr(hwnd), uintptr(idx), style)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func SetWindowPlacement(hwnd syscall.Handle, wp *WindowPlacement) {
|
func SetWindowPlacement(hwnd syscall.Handle, wp *WindowPlacement) {
|
||||||
|
|||||||
Reference in New Issue
Block a user