[v3 Breaking Change] Add NativeWindowHandle method to WebviewWindow.

This commit is contained in:
Lea Anthony
2023-05-30 16:31:49 +08:00
committed by Misite Bao
parent 728e2019d8
commit 17204bebd0
2 changed files with 13 additions and 0 deletions
+9
View File
@@ -1,6 +1,7 @@
package application
import (
"errors"
"fmt"
"github.com/samber/lo"
"sync"
@@ -59,6 +60,7 @@ type (
getScreen() (*Screen, error)
setFrameless(bool)
openContextMenu(menu *Menu, data *ContextMenuData)
nativeWindowHandle() uintptr
}
)
@@ -693,3 +695,10 @@ func (w *WebviewWindow) RegisterContextMenu(name string, menu *Menu) {
defer w.contextMenusLock.Unlock()
w.contextMenus[name] = menu
}
func (w *WebviewWindow) NativeWindowHandle() (uintptr, error) {
if w.impl == nil {
return 0, errors.New("native handle unavailable as window is not running")
}
return w.impl.nativeWindowHandle(), nil
}
@@ -21,6 +21,10 @@ type windowsWebviewWindow struct {
hwnd w32.HWND
}
func (w *windowsWebviewWindow) nativeWindowHandle() uintptr {
return w.hwnd
}
func (w *windowsWebviewWindow) setTitle(title string) {
//TODO implement me
panic("implement me")