mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 18:00:02 +08:00
[v2, windows] Make SetBackgroundColour compatible for windows/386 (#1493)
* [v2, windows] Remove duplicate SetBackgroundColour * [v2, windows] Make SetBackgroundColour compatible for windows/386
This commit is contained in:
parent
16581ceff9
commit
c61ce1e2de
@ -15,6 +15,7 @@ var (
|
|||||||
moduser32 = syscall.NewLazyDLL("user32.dll")
|
moduser32 = syscall.NewLazyDLL("user32.dll")
|
||||||
procSystemParametersInfo = moduser32.NewProc("SystemParametersInfoW")
|
procSystemParametersInfo = moduser32.NewProc("SystemParametersInfoW")
|
||||||
procGetWindowLong = moduser32.NewProc("GetWindowLongW")
|
procGetWindowLong = moduser32.NewProc("GetWindowLongW")
|
||||||
|
procSetClassLong = moduser32.NewProc("SetClassLongW")
|
||||||
procSetClassLongPtr = moduser32.NewProc("SetClassLongPtrW")
|
procSetClassLongPtr = moduser32.NewProc("SetClassLongPtrW")
|
||||||
procShowWindow = moduser32.NewProc("ShowWindow")
|
procShowWindow = moduser32.NewProc("ShowWindow")
|
||||||
)
|
)
|
||||||
|
@ -4,10 +4,12 @@ package win32
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/winc"
|
|
||||||
"log"
|
"log"
|
||||||
|
"strconv"
|
||||||
"syscall"
|
"syscall"
|
||||||
"unsafe"
|
"unsafe"
|
||||||
|
|
||||||
|
"github.com/wailsapp/wails/v2/internal/frontend/desktop/windows/winc"
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -119,7 +121,19 @@ func dwmExtendFrameIntoClientArea(hwnd uintptr, margins *MARGINS) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func setClassLongPtr(hwnd uintptr, param int32, val uintptr) bool {
|
func setClassLongPtr(hwnd uintptr, param int32, val uintptr) bool {
|
||||||
ret, _, _ := procSetClassLongPtr.Call(
|
proc := procSetClassLongPtr
|
||||||
|
if strconv.IntSize == 32 {
|
||||||
|
/*
|
||||||
|
https://docs.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-setclasslongptrw
|
||||||
|
Note: To write code that is compatible with both 32-bit and 64-bit Windows, use SetClassLongPtr.
|
||||||
|
When compiling for 32-bit Windows, SetClassLongPtr is defined as a call to the SetClassLong function
|
||||||
|
|
||||||
|
=> We have to do this dynamically when directly calling the DLL procedures
|
||||||
|
*/
|
||||||
|
proc = procSetClassLong
|
||||||
|
}
|
||||||
|
|
||||||
|
ret, _, _ := proc.Call(
|
||||||
hwnd,
|
hwnd,
|
||||||
uintptr(param),
|
uintptr(param),
|
||||||
val,
|
val,
|
||||||
|
@ -86,10 +86,6 @@ func NewWindow(parent winc.Controller, appoptions *options.App, versionInfo *ope
|
|||||||
result.theme = winoptions.SystemDefault
|
result.theme = winoptions.SystemDefault
|
||||||
}
|
}
|
||||||
|
|
||||||
if appoptions.BackgroundColour != nil {
|
|
||||||
win32.SetBackgroundColour(result.Handle(), appoptions.BackgroundColour.R, appoptions.BackgroundColour.G, appoptions.BackgroundColour.B)
|
|
||||||
}
|
|
||||||
|
|
||||||
result.SetSize(appoptions.Width, appoptions.Height)
|
result.SetSize(appoptions.Width, appoptions.Height)
|
||||||
result.SetText(appoptions.Title)
|
result.SetText(appoptions.Title)
|
||||||
result.EnableSizable(!appoptions.DisableResize)
|
result.EnableSizable(!appoptions.DisableResize)
|
||||||
|
Loading…
Reference in New Issue
Block a user