5
0
mirror of https://github.com/wailsapp/wails.git synced 2025-05-04 01:00:21 +08:00

Fix GetPos and SetPos on Windows

This commit is contained in:
Lea Anthony 2025-04-26 16:57:30 +10:00
parent 4cd91d4fcd
commit 2bc2549160
No known key found for this signature in database
GPG Key ID: 33DAF7BB90A58405
2 changed files with 55 additions and 55 deletions

View File

@ -4,48 +4,49 @@ 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 | | ✅ | ✅ |
| cancel-chaining | | ✅ | ✅ | | cancel-chaining | | ✅ | ✅ |
| clipboard | | ✅ | ✅ | | clipboard | | ✅ | ✅ |
| context-menus | | ✅ | 🚫 panic | | context-menus | | ✅ | 🚫 panic |
| dialogs | | ⚠️ custom icon not working | ⚠️ | | dialogs | | ⚠️ custom icon not working | ⚠️ |
| dialogs-basic | | ✅ | ✅ | | dialogs-basic | | ✅ | ✅ |
| drag-n-drop | | ✅ | ✅ | | drag-n-drop | | ✅ | ✅ |
| environment | | ✅ | ✅ | | environment | | ✅ | ✅ |
| events | | ✅ | ✅ | | events | | ✅ | ✅ |
| file-association | | ✅ | ✅ | | file-association | | ✅ | ✅ |
| frameless | | ✅ | ⚠️ minimise for 3 not working | | frameless | | ✅ | ⚠️ minimise for 3 not working |
| gin-example | | ✅ | ✅ | | gin-example | | ✅ | ✅ |
| gin-routing | | ✅ | ⚠️ cant see difference from gin-example (copy/paste?) | | gin-routing | | ✅ | ⚠️ cant see difference from gin-example (copy/paste?) |
| gin-service | | ✅ | ⚠️ half buttons does nothing? ( getuserbyid ) | | gin-service | | ✅ | ⚠️ half buttons does nothing? ( getuserbyid ) |
| html-dnd-api | | 🚫 | ✅ | | html-dnd-api | | 🚫 | ✅ |
| ignore-mouse | | ✅ | ✅ | | ignore-mouse | | ✅ | ✅ |
| keybindings | | ✅ | ✅ | | keybindings | | ✅ | ✅ |
| menu | | ⚠️ Hide/Unhide issue | ✅ | | menu | | ⚠️ Hide/Unhide issue | ✅ |
| notifications | | ✅ | ⚠️ nothing happens on button click | | notifications | | ✅ | ⚠️ nothing happens on button click |
| panic-handling | | ✅ | ✅ | | panic-handling | | ✅ | ✅ |
| plain | | ✅ | ✅ | | plain | | ✅ | ✅ |
| raw-message | | ✅ | ✅ | | raw-message | | ✅ | ✅ |
| screen | | ✅ | ⚠️ slider bubble drags window | | screen | | ✅ | ⚠️ slider bubble drags window |
| services | | ✅ | ✅ | | services | | ✅ | ✅ |
| show-macos-toolbar | | | ✅ | | show-macos-toolbar | | | ✅ |
| single-instance | | ✅ | ✅ | | single-instance | | ✅ | ✅ |
| systray-basic | | ✅ | ✅ | | systray-basic | | ✅ | ✅ |
| 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 |
| wml | | ✅ | ✅ | | wml | | ✅ | ✅ |
## 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
@ -58,4 +59,4 @@ This document is for tracking the status of the v3-alpha branch in readiness for
- [ ] [Port DLL Directory Initialisation](https://github.com/wailsapp/wails/pull/4207) - [ ] [Port DLL Directory Initialisation](https://github.com/wailsapp/wails/pull/4207)
- [ ] Check if [this](https://github.com/wailsapp/wails/pull/4047#issuecomment-2814676117) needs porting. - [ ] Check if [this](https://github.com/wailsapp/wails/pull/4047#issuecomment-2814676117) needs porting.
- [ ] Update docs - [ ] Update docs
- [ ] Add tutorials - [ ] Add tutorials

View File

@ -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