mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 22:50:59 +08:00
Fix GetPos and SetPos on Windows
This commit is contained in:
parent
4cd91d4fcd
commit
2bc2549160
@ -5,7 +5,7 @@ This document is for tracking the status of the v3-alpha branch in readiness for
|
|||||||
## Examples
|
## Examples
|
||||||
|
|
||||||
| Example | Linux | Windows | macOS |
|
| Example | Linux | Windows | macOS |
|
||||||
|--------------------|-------|--------------------------------------------------|-------------------------------------------------------|
|
|--------------------|-------|----------------------------|-------------------------------------------------------|
|
||||||
| badge | | ✅ | |
|
| badge | | ✅ | |
|
||||||
| binding | | ✅ | ✅ |
|
| binding | | ✅ | ✅ |
|
||||||
| cancel-async | | ✅ | ✅ |
|
| cancel-async | | ✅ | ✅ |
|
||||||
@ -38,7 +38,7 @@ This document is for tracking the status of the v3-alpha branch in readiness for
|
|||||||
| systray-custom | | ✅ | ✅ |
|
| systray-custom | | ✅ | ✅ |
|
||||||
| systray-menu | | ✅ | ✅ |
|
| systray-menu | | ✅ | ✅ |
|
||||||
| video | | ✅ | ✅ |
|
| video | | ✅ | ✅ |
|
||||||
| window | | ⚠️ SetPos 0,0 is going to 5,0. GetPos is correct | ✅ |
|
| window | | ✅ | ✅ |
|
||||||
| window-api | | ✅ | ✅ |
|
| window-api | | ✅ | ✅ |
|
||||||
| window-call | | ✅ | ✅ |
|
| window-call | | ✅ | ✅ |
|
||||||
| window-menubar | | ✅ | ⚠️ not sure what should happen in osx |
|
| window-menubar | | ✅ | ⚠️ not sure what should happen in osx |
|
||||||
@ -46,6 +46,7 @@ This document is for tracking the status of the v3-alpha branch in readiness for
|
|||||||
|
|
||||||
## Open Bugs
|
## Open Bugs
|
||||||
-
|
-
|
||||||
|
|
||||||
- https://github.com/wailsapp/wails/issues/3743
|
- https://github.com/wailsapp/wails/issues/3743
|
||||||
- https://github.com/wailsapp/wails/issues/3683 - needs checking
|
- https://github.com/wailsapp/wails/issues/3683 - needs checking
|
||||||
- https://github.com/wailsapp/wails/issues/4235
|
- https://github.com/wailsapp/wails/issues/4235
|
||||||
|
@ -504,25 +504,24 @@ func (w *windowsWebviewWindow) getBorderSizes() *LRTB {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (w *windowsWebviewWindow) physicalBounds() Rect {
|
func (w *windowsWebviewWindow) physicalBounds() Rect {
|
||||||
// var rect w32.RECT
|
|
||||||
// // Get the extended frame bounds instead of the window rect to offset the invisible borders in Windows 10
|
|
||||||
// w32.DwmGetWindowAttribute(w.hwnd, w32.DWMWA_EXTENDED_FRAME_BOUNDS, unsafe.Pointer(&rect), unsafe.Sizeof(rect))
|
|
||||||
rect := w32.GetWindowRect(w.hwnd)
|
rect := w32.GetWindowRect(w.hwnd)
|
||||||
|
// Compensate for invisible borders
|
||||||
|
borderSize := w.getBorderSizes()
|
||||||
return Rect{
|
return Rect{
|
||||||
X: int(rect.Left),
|
X: int(rect.Left) + borderSize.Left,
|
||||||
Y: int(rect.Top),
|
Y: int(rect.Top) + borderSize.Top,
|
||||||
Width: int(rect.Right - rect.Left),
|
Width: int(rect.Right-rect.Left) - borderSize.Left - borderSize.Right,
|
||||||
Height: int(rect.Bottom - rect.Top),
|
Height: int(rect.Bottom-rect.Top) - borderSize.Top - borderSize.Bottom,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (w *windowsWebviewWindow) setPhysicalBounds(physicalBounds Rect) {
|
func (w *windowsWebviewWindow) setPhysicalBounds(physicalBounds Rect) {
|
||||||
// // Offset invisible borders
|
// Offset invisible borders
|
||||||
// borderSize := w.getBorderSizes()
|
borderSize := w.getBorderSizes()
|
||||||
// physicalBounds.X -= borderSize.Left
|
physicalBounds.X -= borderSize.Left
|
||||||
// physicalBounds.Y -= borderSize.Top
|
physicalBounds.Y -= borderSize.Top
|
||||||
// physicalBounds.Width += borderSize.Left + borderSize.Right
|
physicalBounds.Width += borderSize.Left + borderSize.Right
|
||||||
// physicalBounds.Height += borderSize.Top + borderSize.Bottom
|
physicalBounds.Height += borderSize.Top + borderSize.Bottom
|
||||||
|
|
||||||
// Set flag to ignore resizing the window with DPI change because we already calculated the correct size
|
// Set flag to ignore resizing the window with DPI change because we already calculated the correct size
|
||||||
// for the target position, this prevents double resizing issue when the window is moved between screens
|
// for the target position, this prevents double resizing issue when the window is moved between screens
|
||||||
|
Loading…
Reference in New Issue
Block a user