mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-03 10:23:03 +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
|
## 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
|
||||||
|
@ -90,7 +90,7 @@ func (w *windowsWebviewWindow) paste() {
|
|||||||
try {
|
try {
|
||||||
// Try to read all available formats
|
// Try to read all available formats
|
||||||
const clipboardItems = await navigator.clipboard.read();
|
const clipboardItems = await navigator.clipboard.read();
|
||||||
|
|
||||||
for (const clipboardItem of clipboardItems) {
|
for (const clipboardItem of clipboardItems) {
|
||||||
// Check for image types
|
// Check for image types
|
||||||
for (const type of clipboardItem.types) {
|
for (const type of clipboardItem.types) {
|
||||||
@ -101,7 +101,7 @@ func (w *windowsWebviewWindow) paste() {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// If no image found, try text
|
// If no image found, try text
|
||||||
if (clipboardItem.types.includes('text/plain')) {
|
if (clipboardItem.types.includes('text/plain')) {
|
||||||
const text = await navigator.clipboard.readText();
|
const text = await navigator.clipboard.readText();
|
||||||
@ -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