mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 22:31:06 +08:00
Fix GetPos and SetPos on Windows
This commit is contained in:
parent
4cd91d4fcd
commit
2bc2549160
@ -4,48 +4,49 @@ This document is for tracking the status of the v3-alpha branch in readiness for
|
||||
|
||||
## Examples
|
||||
|
||||
| Example | Linux | Windows | macOS |
|
||||
|--------------------|-------|--------------------------------------------------|-------------------------------------------------------|
|
||||
| badge | | ✅ | |
|
||||
| binding | | ✅ | ✅ |
|
||||
| cancel-async | | ✅ | ✅ |
|
||||
| cancel-chaining | | ✅ | ✅ |
|
||||
| clipboard | | ✅ | ✅ |
|
||||
| context-menus | | ✅ | 🚫 panic |
|
||||
| dialogs | | ⚠️ custom icon not working | ⚠️ |
|
||||
| dialogs-basic | | ✅ | ✅ |
|
||||
| drag-n-drop | | ✅ | ✅ |
|
||||
| environment | | ✅ | ✅ |
|
||||
| events | | ✅ | ✅ |
|
||||
| file-association | | ✅ | ✅ |
|
||||
| frameless | | ✅ | ⚠️ minimise for 3 not working |
|
||||
| gin-example | | ✅ | ✅ |
|
||||
| gin-routing | | ✅ | ⚠️ cant see difference from gin-example (copy/paste?) |
|
||||
| gin-service | | ✅ | ⚠️ half buttons does nothing? ( getuserbyid ) |
|
||||
| html-dnd-api | | 🚫 | ✅ |
|
||||
| ignore-mouse | | ✅ | ✅ |
|
||||
| keybindings | | ✅ | ✅ |
|
||||
| menu | | ⚠️ Hide/Unhide issue | ✅ |
|
||||
| notifications | | ✅ | ⚠️ nothing happens on button click |
|
||||
| panic-handling | | ✅ | ✅ |
|
||||
| plain | | ✅ | ✅ |
|
||||
| raw-message | | ✅ | ✅ |
|
||||
| screen | | ✅ | ⚠️ slider bubble drags window |
|
||||
| services | | ✅ | ✅ |
|
||||
| show-macos-toolbar | | ➖ | ✅ |
|
||||
| single-instance | | ✅ | ✅ |
|
||||
| systray-basic | | ✅ | ✅ |
|
||||
| systray-custom | | ✅ | ✅ |
|
||||
| systray-menu | | ✅ | ✅ |
|
||||
| video | | ✅ | ✅ |
|
||||
| window | | ⚠️ SetPos 0,0 is going to 5,0. GetPos is correct | ✅ |
|
||||
| window-api | | ✅ | ✅ |
|
||||
| window-call | | ✅ | ✅ |
|
||||
| window-menubar | | ✅ | ⚠️ not sure what should happen in osx |
|
||||
| wml | | ✅ | ✅ |
|
||||
| Example | Linux | Windows | macOS |
|
||||
|--------------------|-------|----------------------------|-------------------------------------------------------|
|
||||
| badge | | ✅ | |
|
||||
| binding | | ✅ | ✅ |
|
||||
| cancel-async | | ✅ | ✅ |
|
||||
| cancel-chaining | | ✅ | ✅ |
|
||||
| clipboard | | ✅ | ✅ |
|
||||
| context-menus | | ✅ | 🚫 panic |
|
||||
| dialogs | | ⚠️ custom icon not working | ⚠️ |
|
||||
| dialogs-basic | | ✅ | ✅ |
|
||||
| drag-n-drop | | ✅ | ✅ |
|
||||
| environment | | ✅ | ✅ |
|
||||
| events | | ✅ | ✅ |
|
||||
| file-association | | ✅ | ✅ |
|
||||
| frameless | | ✅ | ⚠️ minimise for 3 not working |
|
||||
| gin-example | | ✅ | ✅ |
|
||||
| gin-routing | | ✅ | ⚠️ cant see difference from gin-example (copy/paste?) |
|
||||
| gin-service | | ✅ | ⚠️ half buttons does nothing? ( getuserbyid ) |
|
||||
| html-dnd-api | | 🚫 | ✅ |
|
||||
| ignore-mouse | | ✅ | ✅ |
|
||||
| keybindings | | ✅ | ✅ |
|
||||
| menu | | ⚠️ Hide/Unhide issue | ✅ |
|
||||
| notifications | | ✅ | ⚠️ nothing happens on button click |
|
||||
| panic-handling | | ✅ | ✅ |
|
||||
| plain | | ✅ | ✅ |
|
||||
| raw-message | | ✅ | ✅ |
|
||||
| screen | | ✅ | ⚠️ slider bubble drags window |
|
||||
| services | | ✅ | ✅ |
|
||||
| show-macos-toolbar | | ➖ | ✅ |
|
||||
| single-instance | | ✅ | ✅ |
|
||||
| systray-basic | | ✅ | ✅ |
|
||||
| systray-custom | | ✅ | ✅ |
|
||||
| systray-menu | | ✅ | ✅ |
|
||||
| video | | ✅ | ✅ |
|
||||
| window | | ✅ | ✅ |
|
||||
| window-api | | ✅ | ✅ |
|
||||
| window-call | | ✅ | ✅ |
|
||||
| window-menubar | | ✅ | ⚠️ not sure what should happen in osx |
|
||||
| wml | | ✅ | ✅ |
|
||||
|
||||
## Open Bugs
|
||||
-
|
||||
|
||||
- https://github.com/wailsapp/wails/issues/3743
|
||||
- https://github.com/wailsapp/wails/issues/3683 - needs checking
|
||||
- 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)
|
||||
- [ ] Check if [this](https://github.com/wailsapp/wails/pull/4047#issuecomment-2814676117) needs porting.
|
||||
- [ ] Update docs
|
||||
- [ ] Add tutorials
|
||||
- [ ] Add tutorials
|
||||
|
@ -90,7 +90,7 @@ func (w *windowsWebviewWindow) paste() {
|
||||
try {
|
||||
// Try to read all available formats
|
||||
const clipboardItems = await navigator.clipboard.read();
|
||||
|
||||
|
||||
for (const clipboardItem of clipboardItems) {
|
||||
// Check for image types
|
||||
for (const type of clipboardItem.types) {
|
||||
@ -101,7 +101,7 @@ func (w *windowsWebviewWindow) paste() {
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// If no image found, try text
|
||||
if (clipboardItem.types.includes('text/plain')) {
|
||||
const text = await navigator.clipboard.readText();
|
||||
@ -504,25 +504,24 @@ func (w *windowsWebviewWindow) getBorderSizes() *LRTB {
|
||||
}
|
||||
|
||||
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)
|
||||
// Compensate for invisible borders
|
||||
borderSize := w.getBorderSizes()
|
||||
return Rect{
|
||||
X: int(rect.Left),
|
||||
Y: int(rect.Top),
|
||||
Width: int(rect.Right - rect.Left),
|
||||
Height: int(rect.Bottom - rect.Top),
|
||||
X: int(rect.Left) + borderSize.Left,
|
||||
Y: int(rect.Top) + borderSize.Top,
|
||||
Width: int(rect.Right-rect.Left) - borderSize.Left - borderSize.Right,
|
||||
Height: int(rect.Bottom-rect.Top) - borderSize.Top - borderSize.Bottom,
|
||||
}
|
||||
}
|
||||
|
||||
func (w *windowsWebviewWindow) setPhysicalBounds(physicalBounds Rect) {
|
||||
// // Offset invisible borders
|
||||
// borderSize := w.getBorderSizes()
|
||||
// physicalBounds.X -= borderSize.Left
|
||||
// physicalBounds.Y -= borderSize.Top
|
||||
// physicalBounds.Width += borderSize.Left + borderSize.Right
|
||||
// physicalBounds.Height += borderSize.Top + borderSize.Bottom
|
||||
// Offset invisible borders
|
||||
borderSize := w.getBorderSizes()
|
||||
physicalBounds.X -= borderSize.Left
|
||||
physicalBounds.Y -= borderSize.Top
|
||||
physicalBounds.Width += borderSize.Left + borderSize.Right
|
||||
physicalBounds.Height += borderSize.Top + borderSize.Bottom
|
||||
|
||||
// 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
|
||||
|
Loading…
Reference in New Issue
Block a user