mirror of
https://github.com/wailsapp/wails.git
synced 2026-03-14 14:45:49 +01:00
Merge branch 'v3-alpha-bugfix/event-emmission' into v3-alpha
# Conflicts: # v3/internal/runtime/desktop/@wailsio/runtime/package.json
This commit is contained in:
commit
e794f5d6d8
37 changed files with 981 additions and 686 deletions
|
|
@ -32,6 +32,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- New `-git` flag for `wails3 init` command by [@leaanthony](https://github.com/leaanthony)
|
||||
- New `wails3 generate webview2bootstrapper` command by [@leaanthony](https://github.com/leaanthony)
|
||||
- Added `init()` method in runtime to allow manual initialisation of the runtime by [@leaanthony](https://github.com/leaanthony)
|
||||
- Added `WindowDidMoveDebounceMS` option to Window's WindowOptions by [@leaanthony](https://github.com/leaanthony)
|
||||
|
||||
### Fixed
|
||||
|
||||
|
|
@ -45,6 +46,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Improved window destroying logic by [@leaanthony](https://github.com/leaanthony)
|
||||
- Fix window position logic when attached to system trays by [@leaanthony](https://github.com/leaanthony)
|
||||
- Support fullscreen for frameless windows by [@leaanthony](https://github.com/leaanthony)
|
||||
- Fix event handling by [@leaanthony](https://github.com/leaanthony)
|
||||
- Fixed window shutdown logic by [@leaanthony](https://github.com/leaanthony)
|
||||
|
||||
### Changed
|
||||
|
||||
|
|
@ -52,6 +55,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||
- Moved and renamed Taskfiles to platform specific directories by [@leaanthony](https://github.com/leaanthony)
|
||||
- Created a much better experience when `index.html` is missing by [@leaanthony](https://github.com/leaanthony)
|
||||
- [Windows] Improved performance of minimise and restore by [@leaanthony](https://github.com/leaanthony). Based on original [PR](https://github.com/wailsapp/wails/pull/3955) by [562589540](https://github.com/562589540)
|
||||
- Removed `ShouldClose` option (Register a hook for events.Common.WindowClosing instead) by [@leaanthony](https://github.com/leaanthony)
|
||||
- [Windows] Reduced flicker when opening a window by [@leaanthony](https://github.com/leaanthony)
|
||||
- Removed `Window.Destroy` as this was intended to be an internal function by [@leaanthony](https://github.com/leaanthony)
|
||||
- Renamed `WindowClose` events to `WindowClosing` by [@leaanthony](https://github.com/leaanthony)
|
||||
|
||||
|
||||
## v3.0.0-alpha.8.3 - 2024-12-07
|
||||
|
||||
|
|
|
|||
|
|
@ -21,12 +21,27 @@
|
|||
}
|
||||
</style>
|
||||
<script type="module" src="/wails/runtime.js"></script>
|
||||
<script type="module">
|
||||
document.addEventListener('DOMContentLoaded', (event) => {
|
||||
let minimiseButton = document.querySelector('#min');
|
||||
minimiseButton.addEventListener('click', function(event) {
|
||||
window.wails.Window.Minimise();
|
||||
setTimeout(function() {
|
||||
window.wails.Window.UnMinimise();
|
||||
}, 3000);
|
||||
});
|
||||
let closeButton = document.querySelector('#close');
|
||||
closeButton.addEventListener('click', function(event) {
|
||||
window.wails.Window.Close();
|
||||
});
|
||||
});
|
||||
</script>
|
||||
</head>
|
||||
<body>
|
||||
<div class="container">
|
||||
<div class="quarter" style="background-color: lightblue; --wails-draggable: drag">Draggable</div>
|
||||
<div class="quarter" style="background-color: lightgreen;">Not Draggable</div>
|
||||
<div class="quarter" style="background-color: lightpink;">Not Draggable</div>
|
||||
<div class="quarter" style="background-color: lightgreen;"><div>Not Draggable</div><button id="min">Minimise for 3s</button></div>
|
||||
<div class="quarter" style="background-color: lightpink;"><div>Not Draggable</div><button id="close">Close</button></div>
|
||||
<div class="quarter" style="background-color: lightyellow; --wails-draggable: drag">Draggable</div>
|
||||
</div>
|
||||
</body>
|
||||
|
|
|
|||
|
|
@ -2,12 +2,11 @@ package main
|
|||
|
||||
import (
|
||||
_ "embed"
|
||||
"log"
|
||||
"runtime"
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
"github.com/wailsapp/wails/v3/pkg/events"
|
||||
"github.com/wailsapp/wails/v3/pkg/icons"
|
||||
"log"
|
||||
"runtime"
|
||||
)
|
||||
|
||||
func main() {
|
||||
|
|
@ -29,16 +28,16 @@ func main() {
|
|||
AlwaysOnTop: false,
|
||||
Hidden: false,
|
||||
DisableResize: false,
|
||||
ShouldClose: func(window *application.WebviewWindow) bool {
|
||||
println("close")
|
||||
window.Hide()
|
||||
return false
|
||||
},
|
||||
Windows: application.WindowsWindow{
|
||||
HiddenOnTaskbar: true,
|
||||
},
|
||||
})
|
||||
|
||||
window.RegisterHook(events.Common.WindowClosing, func(e *application.WindowEvent) {
|
||||
window.Hide()
|
||||
e.Cancel()
|
||||
})
|
||||
|
||||
if runtime.GOOS == "darwin" {
|
||||
systemTray.SetTemplateIcon(icons.SystrayMacTemplate)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
_ "embed"
|
||||
"github.com/wailsapp/wails/v3/pkg/events"
|
||||
"log"
|
||||
"runtime"
|
||||
|
||||
|
|
@ -29,10 +30,6 @@ func main() {
|
|||
AlwaysOnTop: true,
|
||||
Hidden: true,
|
||||
DisableResize: true,
|
||||
ShouldClose: func(window *application.WebviewWindow) bool {
|
||||
window.Hide()
|
||||
return false
|
||||
},
|
||||
Windows: application.WindowsWindow{
|
||||
HiddenOnTaskbar: true,
|
||||
},
|
||||
|
|
@ -43,6 +40,14 @@ func main() {
|
|||
},
|
||||
})
|
||||
|
||||
// Register a hook to hide the window when the window is closing
|
||||
window.RegisterHook(events.Common.WindowClosing, func(e *application.WindowEvent) {
|
||||
// Hide the window
|
||||
window.Hide()
|
||||
// Cancel the event so it doesn't get destroyed
|
||||
e.Cancel()
|
||||
})
|
||||
|
||||
if runtime.GOOS == "darwin" {
|
||||
systemTray.SetTemplateIcon(icons.SystrayMacTemplate)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -2,65 +2,69 @@ package main
|
|||
|
||||
import (
|
||||
_ "embed"
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
"github.com/wailsapp/wails/v3/pkg/events"
|
||||
"github.com/wailsapp/wails/v3/pkg/icons"
|
||||
"log"
|
||||
"runtime"
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
"github.com/wailsapp/wails/v3/pkg/icons"
|
||||
)
|
||||
|
||||
var windowShowing bool
|
||||
|
||||
func createWindow(app *application.App) {
|
||||
if windowShowing {
|
||||
return
|
||||
}
|
||||
// Log the time taken to create the window
|
||||
window := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||
Width: 500,
|
||||
Height: 500,
|
||||
Name: "Systray Demo Window",
|
||||
AlwaysOnTop: true,
|
||||
Hidden: true,
|
||||
BackgroundColour: application.NewRGB(33, 37, 41),
|
||||
DisableResize: true,
|
||||
Windows: application.WindowsWindow{
|
||||
HiddenOnTaskbar: true,
|
||||
},
|
||||
})
|
||||
windowShowing = true
|
||||
|
||||
window.OnWindowEvent(events.Common.WindowClosing, func(e *application.WindowEvent) {
|
||||
windowShowing = false
|
||||
})
|
||||
|
||||
window.Show()
|
||||
}
|
||||
|
||||
func main() {
|
||||
app := application.New(application.Options{
|
||||
Name: "Systray Demo",
|
||||
Description: "A demo of the Systray API",
|
||||
Assets: application.AlphaAssets,
|
||||
Windows: application.WindowsOptions{
|
||||
DisableQuitOnLastWindowClosed: true,
|
||||
},
|
||||
Mac: application.MacOptions{
|
||||
ActivationPolicy: application.ActivationPolicyAccessory,
|
||||
},
|
||||
})
|
||||
|
||||
systemTray := app.NewSystemTray()
|
||||
|
||||
window := app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||
Width: 500,
|
||||
Height: 500,
|
||||
Name: "Systray Demo Window",
|
||||
Frameless: true,
|
||||
AlwaysOnTop: true,
|
||||
Hidden: true,
|
||||
DisableResize: true,
|
||||
ShouldClose: func(window *application.WebviewWindow) bool {
|
||||
window.Hide()
|
||||
return false
|
||||
},
|
||||
Windows: application.WindowsWindow{
|
||||
HiddenOnTaskbar: true,
|
||||
},
|
||||
menu := app.NewMenu()
|
||||
menu.Add("Quit").OnClick(func(data *application.Context) {
|
||||
app.Quit()
|
||||
})
|
||||
systemTray.SetMenu(menu)
|
||||
|
||||
if runtime.GOOS == "darwin" {
|
||||
systemTray.SetTemplateIcon(icons.SystrayMacTemplate)
|
||||
}
|
||||
|
||||
systemTray.OnClick(func() {
|
||||
println("System tray clicked!")
|
||||
if window.IsVisible() {
|
||||
window.Hide()
|
||||
} else {
|
||||
window.Show()
|
||||
}
|
||||
createWindow(app)
|
||||
})
|
||||
|
||||
systemTray.OnDoubleClick(func() {
|
||||
println("System tray double clicked!")
|
||||
})
|
||||
|
||||
systemTray.OnRightClick(func() {
|
||||
println("System tray right clicked!")
|
||||
})
|
||||
|
||||
systemTray.AttachWindow(window).WindowOffset(5)
|
||||
|
||||
err := app.Run()
|
||||
if err != nil {
|
||||
log.Fatal(err)
|
||||
|
|
|
|||
BIN
v3/examples/systray-menu/logo-dark-xsmall.png
Normal file
BIN
v3/examples/systray-menu/logo-dark-xsmall.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.7 KiB |
|
|
@ -2,6 +2,7 @@ package main
|
|||
|
||||
import (
|
||||
_ "embed"
|
||||
"github.com/wailsapp/wails/v3/pkg/events"
|
||||
"log"
|
||||
"runtime"
|
||||
|
||||
|
|
@ -9,6 +10,9 @@ import (
|
|||
"github.com/wailsapp/wails/v3/pkg/icons"
|
||||
)
|
||||
|
||||
//go:embed logo-dark-xsmall.png
|
||||
var logo []byte
|
||||
|
||||
func main() {
|
||||
app := application.New(application.Options{
|
||||
Name: "Systray Demo",
|
||||
|
|
@ -29,10 +33,6 @@ func main() {
|
|||
AlwaysOnTop: true,
|
||||
Hidden: true,
|
||||
DisableResize: true,
|
||||
ShouldClose: func(window *application.WebviewWindow) bool {
|
||||
window.Hide()
|
||||
return false
|
||||
},
|
||||
Windows: application.WindowsWindow{
|
||||
HiddenOnTaskbar: true,
|
||||
},
|
||||
|
|
@ -43,12 +43,17 @@ func main() {
|
|||
},
|
||||
})
|
||||
|
||||
window.RegisterHook(events.Common.WindowClosing, func(e *application.WindowEvent) {
|
||||
window.Hide()
|
||||
e.Cancel()
|
||||
})
|
||||
|
||||
if runtime.GOOS == "darwin" {
|
||||
systemTray.SetTemplateIcon(icons.SystrayMacTemplate)
|
||||
}
|
||||
|
||||
myMenu := app.NewMenu()
|
||||
myMenu.Add("Wails").SetBitmap(icons.WailsLogoBlackTransparent).SetEnabled(false)
|
||||
myMenu.Add("Wails").SetBitmap(logo).SetEnabled(false)
|
||||
|
||||
myMenu.Add("Hello World!").OnClick(func(ctx *application.Context) {
|
||||
println("Hello World!")
|
||||
|
|
|
|||
|
|
@ -283,31 +283,29 @@ func main() {
|
|||
myMenu.Add("New WebviewWindow (Hides on Close one time)").
|
||||
SetAccelerator("CmdOrCtrl+H").
|
||||
OnClick(func(ctx *application.Context) {
|
||||
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||
// This will be called when the user clicks the close button
|
||||
// on the window. It will hide the window for 5 seconds.
|
||||
// If the user clicks the close button again, the window will
|
||||
// close.
|
||||
ShouldClose: func(window *application.WebviewWindow) bool {
|
||||
if !lo.Contains(hiddenWindows, window) {
|
||||
hiddenWindows = append(hiddenWindows, window)
|
||||
go func() {
|
||||
time.Sleep(5 * time.Second)
|
||||
window.Show()
|
||||
}()
|
||||
window.Hide()
|
||||
return false
|
||||
}
|
||||
// Remove the window from the hiddenWindows list
|
||||
hiddenWindows = lo.Without(hiddenWindows, window)
|
||||
return true
|
||||
},
|
||||
}).
|
||||
SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
|
||||
w := app.NewWebviewWindow()
|
||||
|
||||
w.RegisterHook(events.Common.WindowClosing, func(e *application.WindowEvent) {
|
||||
if !lo.Contains(hiddenWindows, w) {
|
||||
hiddenWindows = append(hiddenWindows, w)
|
||||
go func() {
|
||||
time.Sleep(5 * time.Second)
|
||||
w.Show()
|
||||
}()
|
||||
w.Hide()
|
||||
e.Cancel()
|
||||
}
|
||||
// Remove the window from the hiddenWindows list
|
||||
hiddenWindows = lo.Without(hiddenWindows, w)
|
||||
})
|
||||
|
||||
w.SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
|
||||
SetRelativePosition(rand.Intn(1000), rand.Intn(800)).
|
||||
SetURL("https://wails.io").
|
||||
Show()
|
||||
|
||||
windowCounter++
|
||||
|
||||
})
|
||||
myMenu.Add("New WebviewWindow (Frameless)").
|
||||
SetAccelerator("CmdOrCtrl+F").
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ require (
|
|||
github.com/pterm/pterm v0.12.51
|
||||
github.com/samber/lo v1.38.1
|
||||
github.com/tc-hib/winres v0.3.1
|
||||
github.com/wailsapp/go-webview2 v1.0.18
|
||||
github.com/wailsapp/go-webview2 v1.0.19-0.20241227010006-11c6e567b916
|
||||
github.com/wailsapp/mimetype v1.4.1
|
||||
github.com/wailsapp/task/v3 v3.40.1-patched3
|
||||
golang.org/x/sys v0.28.0
|
||||
|
|
|
|||
|
|
@ -305,6 +305,8 @@ github.com/ulikunitz/xz v0.5.12 h1:37Nm15o69RwBkXM0J6A5OlE67RZTfzUxTj8fB3dfcsc=
|
|||
github.com/ulikunitz/xz v0.5.12/go.mod h1:nbz6k7qbPmH4IRqmfOplQw/tblSgqTqBwxkY0oWt/14=
|
||||
github.com/wailsapp/go-webview2 v1.0.18 h1:SSSCoLA+MYikSp1U0WmvELF/4c3x5kH8Vi31TKyZ4yk=
|
||||
github.com/wailsapp/go-webview2 v1.0.18/go.mod h1:qJmWAmAmaniuKGZPWwne+uor3AHMB5PFhqiK0Bbj8kc=
|
||||
github.com/wailsapp/go-webview2 v1.0.19-0.20241227010006-11c6e567b916 h1:W0UQJWILiXJOOCg7ec5xJNqxkg4Ced5KCGO4tFAf13w=
|
||||
github.com/wailsapp/go-webview2 v1.0.19-0.20241227010006-11c6e567b916/go.mod h1:qJmWAmAmaniuKGZPWwne+uor3AHMB5PFhqiK0Bbj8kc=
|
||||
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
|
||||
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
|
||||
github.com/wailsapp/task/v3 v3.40.1-patched3 h1:i6O1WNdSur9CGaiMDIYGjsmj/qS4465zqv+WEs6sPRs=
|
||||
|
|
|
|||
|
|
@ -60,27 +60,21 @@ func main() {
|
|||
myMenu.Add("New WebviewWindow (Hides on Close one time)").
|
||||
SetAccelerator("CmdOrCtrl+H").
|
||||
OnClick(func(ctx *application.Context) {
|
||||
app.NewWebviewWindowWithOptions(application.WebviewWindowOptions{
|
||||
// This will be called when the user clicks the close button
|
||||
// on the window. It will hide the window for 5 seconds.
|
||||
// If the user clicks the close button again, the window will
|
||||
// close.
|
||||
ShouldClose: func(window *application.WebviewWindow) bool {
|
||||
if !lo.Contains(hiddenWindows, window) {
|
||||
hiddenWindows = append(hiddenWindows, window)
|
||||
go func() {
|
||||
time.Sleep(5 * time.Second)
|
||||
window.Show()
|
||||
}()
|
||||
window.Hide()
|
||||
return false
|
||||
}
|
||||
// Remove the window from the hiddenWindows list
|
||||
hiddenWindows = lo.Without(hiddenWindows, window)
|
||||
return true
|
||||
},
|
||||
}).
|
||||
SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
|
||||
w := app.NewWebviewWindow()
|
||||
w.RegisterHook(events.Common.WindowClosing, func(e *application.WindowEvent) {
|
||||
if !lo.Contains(hiddenWindows, w) {
|
||||
hiddenWindows = append(hiddenWindows, w)
|
||||
go func() {
|
||||
time.Sleep(5 * time.Second)
|
||||
w.Show()
|
||||
}()
|
||||
w.Hide()
|
||||
e.Cancel()
|
||||
}
|
||||
// Remove the window from the hiddenWindows list
|
||||
hiddenWindows = lo.Without(hiddenWindows, w)
|
||||
})
|
||||
w.SetTitle("WebviewWindow "+strconv.Itoa(windowCounter)).
|
||||
SetRelativePosition(rand.Intn(1000), rand.Intn(800)).
|
||||
SetURL("https://wails.io").
|
||||
Show()
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "@wailsio/runtime",
|
||||
"type": "module",
|
||||
"version": "3.0.0-alpha.30",
|
||||
"version": "3.0.0-alpha.35",
|
||||
"description": "Wails Runtime",
|
||||
"types": "types/index.d.ts",
|
||||
"exports": {
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export const EventTypes = {
|
|||
WindowRestore: "windows:WindowRestore",
|
||||
WindowMinimise: "windows:WindowMinimise",
|
||||
WindowUnMinimise: "windows:WindowUnMinimise",
|
||||
WindowClose: "windows:WindowClose",
|
||||
WindowClosing: "windows:WindowClosing",
|
||||
WindowSetFocus: "windows:WindowSetFocus",
|
||||
WindowKillFocus: "windows:WindowKillFocus",
|
||||
WindowDragDrop: "windows:WindowDragDrop",
|
||||
|
|
@ -28,6 +28,22 @@ export const EventTypes = {
|
|||
WindowDragOver: "windows:WindowDragOver",
|
||||
WindowDidMove: "windows:WindowDidMove",
|
||||
WindowDidResize: "windows:WindowDidResize",
|
||||
WindowShow: "windows:WindowShow",
|
||||
WindowHide: "windows:WindowHide",
|
||||
WindowStartMove: "windows:WindowStartMove",
|
||||
WindowEndMove: "windows:WindowEndMove",
|
||||
WindowStartResize: "windows:WindowStartResize",
|
||||
WindowEndResize: "windows:WindowEndResize",
|
||||
WindowKeyDown: "windows:WindowKeyDown",
|
||||
WindowKeyUp: "windows:WindowKeyUp",
|
||||
WindowZOrderChanged: "windows:WindowZOrderChanged",
|
||||
WindowPaint: "windows:WindowPaint",
|
||||
WindowBackgroundErase: "windows:WindowBackgroundErase",
|
||||
WindowNonClientHit: "windows:WindowNonClientHit",
|
||||
WindowNonClientMouseDown: "windows:WindowNonClientMouseDown",
|
||||
WindowNonClientMouseUp: "windows:WindowNonClientMouseUp",
|
||||
WindowNonClientMouseMove: "windows:WindowNonClientMouseMove",
|
||||
WindowNonClientMouseLeave: "windows:WindowNonClientMouseLeave",
|
||||
},
|
||||
Mac: {
|
||||
ApplicationDidBecomeActive: "mac:ApplicationDidBecomeActive",
|
||||
|
|
@ -72,10 +88,15 @@ export const EventTypes = {
|
|||
WindowDidChangeSpaceOrderingMode: "mac:WindowDidChangeSpaceOrderingMode",
|
||||
WindowDidChangeTitle: "mac:WindowDidChangeTitle",
|
||||
WindowDidChangeToolbar: "mac:WindowDidChangeToolbar",
|
||||
WindowDidChangeVisibility: "mac:WindowDidChangeVisibility",
|
||||
WindowDidDeminiaturize: "mac:WindowDidDeminiaturize",
|
||||
WindowDidEndSheet: "mac:WindowDidEndSheet",
|
||||
WindowDidEnterFullScreen: "mac:WindowDidEnterFullScreen",
|
||||
WindowMaximise: "mac:WindowMaximise",
|
||||
WindowUnMaximise: "mac:WindowUnMaximise",
|
||||
WindowDidZoom: "mac:WindowDidZoom!",
|
||||
WindowZoomIn: "mac:WindowZoomIn!",
|
||||
WindowZoomOut: "mac:WindowZoomOut!",
|
||||
WindowZoomReset: "mac:WindowZoomReset!",
|
||||
WindowDidEnterVersionBrowser: "mac:WindowDidEnterVersionBrowser",
|
||||
WindowDidExitFullScreen: "mac:WindowDidExitFullScreen",
|
||||
WindowDidExitVersionBrowser: "mac:WindowDidExitVersionBrowser",
|
||||
|
|
@ -95,7 +116,6 @@ export const EventTypes = {
|
|||
WindowDidUpdateShadow: "mac:WindowDidUpdateShadow",
|
||||
WindowDidUpdateTitle: "mac:WindowDidUpdateTitle",
|
||||
WindowDidUpdateToolbar: "mac:WindowDidUpdateToolbar",
|
||||
WindowDidUpdateVisibility: "mac:WindowDidUpdateVisibility",
|
||||
WindowShouldClose: "mac:WindowShouldClose!",
|
||||
WindowWillBecomeKey: "mac:WindowWillBecomeKey",
|
||||
WindowWillBecomeMain: "mac:WindowWillBecomeMain",
|
||||
|
|
|
|||
|
|
@ -19,7 +19,7 @@ export declare const EventTypes: {
|
|||
WindowRestore: string,
|
||||
WindowMinimise: string,
|
||||
WindowUnMinimise: string,
|
||||
WindowClose: string,
|
||||
WindowClosing: string,
|
||||
WindowSetFocus: string,
|
||||
WindowKillFocus: string,
|
||||
WindowDragDrop: string,
|
||||
|
|
@ -28,6 +28,22 @@ export declare const EventTypes: {
|
|||
WindowDragOver: string,
|
||||
WindowDidMove: string,
|
||||
WindowDidResize: string,
|
||||
WindowShow: string,
|
||||
WindowHide: string,
|
||||
WindowStartMove: string,
|
||||
WindowEndMove: string,
|
||||
WindowStartResize: string,
|
||||
WindowEndResize: string,
|
||||
WindowKeyDown: string,
|
||||
WindowKeyUp: string,
|
||||
WindowZOrderChanged: string,
|
||||
WindowPaint: string,
|
||||
WindowBackgroundErase: string,
|
||||
WindowNonClientHit: string,
|
||||
WindowNonClientMouseDown: string,
|
||||
WindowNonClientMouseUp: string,
|
||||
WindowNonClientMouseMove: string,
|
||||
WindowNonClientMouseLeave: string,
|
||||
},
|
||||
Mac: {
|
||||
ApplicationDidBecomeActive: string,
|
||||
|
|
@ -72,10 +88,15 @@ export declare const EventTypes: {
|
|||
WindowDidChangeSpaceOrderingMode: string,
|
||||
WindowDidChangeTitle: string,
|
||||
WindowDidChangeToolbar: string,
|
||||
WindowDidChangeVisibility: string,
|
||||
WindowDidDeminiaturize: string,
|
||||
WindowDidEndSheet: string,
|
||||
WindowDidEnterFullScreen: string,
|
||||
WindowMaximise: string,
|
||||
WindowUnMaximise: string,
|
||||
WindowDidZoom: string,
|
||||
WindowZoomIn: string,
|
||||
WindowZoomOut: string,
|
||||
WindowZoomReset: string,
|
||||
WindowDidEnterVersionBrowser: string,
|
||||
WindowDidExitFullScreen: string,
|
||||
WindowDidExitVersionBrowser: string,
|
||||
|
|
@ -95,7 +116,6 @@ export declare const EventTypes: {
|
|||
WindowDidUpdateShadow: string,
|
||||
WindowDidUpdateTitle: string,
|
||||
WindowDidUpdateToolbar: string,
|
||||
WindowDidUpdateVisibility: string,
|
||||
WindowShouldClose: string,
|
||||
WindowWillBecomeKey: string,
|
||||
WindowWillBecomeMain: string,
|
||||
|
|
|
|||
|
|
@ -781,13 +781,13 @@ func (a *App) cleanup() {
|
|||
InvokeSync(func() {
|
||||
a.windowsLock.RLock()
|
||||
for _, window := range a.windows {
|
||||
window.Destroy()
|
||||
window.Close()
|
||||
}
|
||||
a.windows = nil
|
||||
a.windowsLock.RUnlock()
|
||||
a.systemTraysLock.Lock()
|
||||
for _, systray := range a.systemTrays {
|
||||
systray.Destroy()
|
||||
systray.destroy()
|
||||
}
|
||||
a.systemTrays = nil
|
||||
a.systemTraysLock.Unlock()
|
||||
|
|
|
|||
|
|
@ -95,7 +95,7 @@ static void run(void) {
|
|||
}
|
||||
}
|
||||
|
||||
// Destroy application
|
||||
// destroyApp destroys the application
|
||||
static void destroyApp(void) {
|
||||
[NSApp terminate:nil];
|
||||
}
|
||||
|
|
|
|||
|
|
@ -161,7 +161,7 @@ func (m *windowsApp) destroy() {
|
|||
return
|
||||
}
|
||||
globalApplication.cleanup()
|
||||
// Destroy the main thread window
|
||||
// destroy the main thread window
|
||||
w32.DestroyWindow(m.mainThreadWindowHWND)
|
||||
// Post a quit message to the main thread
|
||||
w32.PostQuitMessage(0)
|
||||
|
|
|
|||
File diff suppressed because one or more lines are too long
|
|
@ -13,7 +13,7 @@ import (
|
|||
|
||||
func DefaultLogger(level slog.Level) *slog.Logger {
|
||||
return slog.New(tint.NewHandler(colorable.NewColorable(os.Stderr), &tint.Options{
|
||||
TimeFormat: time.Kitchen,
|
||||
TimeFormat: time.StampMilli,
|
||||
NoColor: !isatty.IsTerminal(os.Stderr.Fd()),
|
||||
Level: level,
|
||||
}))
|
||||
|
|
|
|||
|
|
@ -184,7 +184,7 @@ func (s *SystemTray) SetTemplateIcon(icon []byte) *SystemTray {
|
|||
return s
|
||||
}
|
||||
|
||||
func (s *SystemTray) Destroy() {
|
||||
func (s *SystemTray) destroy() {
|
||||
if s.impl == nil {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -388,7 +388,7 @@ func (s *windowsSystemTray) destroy() {
|
|||
s.menu.Destroy()
|
||||
}
|
||||
w32.DestroyWindow(s.hwnd)
|
||||
// Destroy the notification icon
|
||||
// destroy the notification icon
|
||||
nid := s.newNotifyIconData()
|
||||
if !w32.ShellNotifyIcon(w32.NIM_DELETE, &nid) {
|
||||
globalApplication.debug(syscall.GetLastError().Error())
|
||||
|
|
|
|||
|
|
@ -162,6 +162,9 @@ type WebviewWindow struct {
|
|||
runtimeLoaded bool
|
||||
// pendingJS holds JS that was sent to the window before the runtime was loaded
|
||||
pendingJS []string
|
||||
|
||||
// unconditionallyClose marks the window to be unconditionally closed
|
||||
unconditionallyClose bool
|
||||
}
|
||||
|
||||
// EmitEvent emits an event from the window
|
||||
|
|
@ -250,15 +253,10 @@ func NewWindow(options WebviewWindowOptions) *WebviewWindow {
|
|||
|
||||
// Listen for window closing events and de
|
||||
result.OnWindowEvent(events.Common.WindowClosing, func(event *WindowEvent) {
|
||||
shouldClose := true
|
||||
if result.options.ShouldClose != nil {
|
||||
shouldClose = result.options.ShouldClose(result)
|
||||
}
|
||||
if shouldClose {
|
||||
result.markAsDestroyed()
|
||||
InvokeSync(result.impl.close)
|
||||
globalApplication.deleteWindowByID(result.id)
|
||||
}
|
||||
result.unconditionallyClose = true
|
||||
InvokeSync(result.markAsDestroyed)
|
||||
InvokeSync(result.impl.close)
|
||||
globalApplication.deleteWindowByID(result.id)
|
||||
})
|
||||
|
||||
// Process keybindings
|
||||
|
|
@ -395,6 +393,7 @@ func (w *WebviewWindow) Run() {
|
|||
return
|
||||
}
|
||||
w.impl = newWindowImpl(w)
|
||||
|
||||
InvokeSync(w.impl.run)
|
||||
}
|
||||
|
||||
|
|
@ -414,14 +413,12 @@ func (w *WebviewWindow) Show() Window {
|
|||
if globalApplication.impl == nil {
|
||||
return w
|
||||
}
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
InvokeSync(w.Run)
|
||||
return w
|
||||
}
|
||||
InvokeSync(func() {
|
||||
w.impl.show()
|
||||
w.emit(events.Common.WindowShow)
|
||||
})
|
||||
w.options.Hidden = false
|
||||
InvokeSync(w.impl.show)
|
||||
return w
|
||||
}
|
||||
|
||||
|
|
@ -429,10 +426,7 @@ func (w *WebviewWindow) Show() Window {
|
|||
func (w *WebviewWindow) Hide() Window {
|
||||
w.options.Hidden = true
|
||||
if w.impl != nil {
|
||||
InvokeSync(func() {
|
||||
w.impl.hide()
|
||||
w.emit(events.Common.WindowHide)
|
||||
})
|
||||
InvokeSync(w.impl.hide)
|
||||
}
|
||||
return w
|
||||
}
|
||||
|
|
@ -441,7 +435,7 @@ func (w *WebviewWindow) SetURL(s string) Window {
|
|||
url, _ := assetserver.GetStartURL(s)
|
||||
w.options.URL = url
|
||||
if w.impl != nil {
|
||||
InvokeAsync(func() {
|
||||
InvokeSync(func() {
|
||||
w.impl.setURL(url)
|
||||
})
|
||||
}
|
||||
|
|
@ -459,7 +453,7 @@ func (w *WebviewWindow) GetBorderSizes() *LRTB {
|
|||
func (w *WebviewWindow) SetZoom(magnification float64) Window {
|
||||
w.options.Zoom = magnification
|
||||
if w.impl != nil {
|
||||
InvokeAsync(func() {
|
||||
InvokeSync(func() {
|
||||
w.impl.setZoom(magnification)
|
||||
})
|
||||
}
|
||||
|
|
@ -478,7 +472,7 @@ func (w *WebviewWindow) GetZoom() float64 {
|
|||
func (w *WebviewWindow) SetResizable(b bool) Window {
|
||||
w.options.DisableResize = !b
|
||||
if w.impl != nil {
|
||||
InvokeAsync(func() {
|
||||
InvokeSync(func() {
|
||||
w.impl.setResizable(b)
|
||||
})
|
||||
}
|
||||
|
|
@ -511,11 +505,11 @@ func (w *WebviewWindow) SetMinSize(minWidth, minHeight int) Window {
|
|||
}
|
||||
if w.impl != nil {
|
||||
if newSize {
|
||||
InvokeAsync(func() {
|
||||
InvokeSync(func() {
|
||||
w.impl.setSize(newWidth, newHeight)
|
||||
})
|
||||
}
|
||||
InvokeAsync(func() {
|
||||
InvokeSync(func() {
|
||||
w.impl.setMinSize(minWidth, minHeight)
|
||||
})
|
||||
}
|
||||
|
|
@ -543,11 +537,11 @@ func (w *WebviewWindow) SetMaxSize(maxWidth, maxHeight int) Window {
|
|||
}
|
||||
if w.impl != nil {
|
||||
if newSize {
|
||||
InvokeAsync(func() {
|
||||
InvokeSync(func() {
|
||||
w.impl.setSize(newWidth, newHeight)
|
||||
})
|
||||
}
|
||||
InvokeAsync(func() {
|
||||
InvokeSync(func() {
|
||||
w.impl.setMaxSize(maxWidth, maxHeight)
|
||||
})
|
||||
}
|
||||
|
|
@ -556,11 +550,11 @@ func (w *WebviewWindow) SetMaxSize(maxWidth, maxHeight int) Window {
|
|||
|
||||
// ExecJS executes the given javascript in the context of the window.
|
||||
func (w *WebviewWindow) ExecJS(js string) {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
if w.runtimeLoaded {
|
||||
InvokeAsync(func() {
|
||||
InvokeSync(func() {
|
||||
w.impl.execJS(js)
|
||||
})
|
||||
} else {
|
||||
|
|
@ -570,13 +564,13 @@ func (w *WebviewWindow) ExecJS(js string) {
|
|||
|
||||
// Fullscreen sets the window to fullscreen mode. Min/Max size constraints are disabled.
|
||||
func (w *WebviewWindow) Fullscreen() Window {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
w.options.StartState = WindowStateFullscreen
|
||||
return w
|
||||
}
|
||||
if !w.IsFullscreen() {
|
||||
w.DisableSizeConstraints()
|
||||
InvokeAsync(w.impl.fullscreen)
|
||||
InvokeSync(w.impl.fullscreen)
|
||||
}
|
||||
return w
|
||||
}
|
||||
|
|
@ -584,7 +578,7 @@ func (w *WebviewWindow) Fullscreen() Window {
|
|||
func (w *WebviewWindow) SetMinimiseButtonState(state ButtonState) Window {
|
||||
w.options.MinimiseButtonState = state
|
||||
if w.impl != nil {
|
||||
InvokeAsync(func() {
|
||||
InvokeSync(func() {
|
||||
w.impl.setMinimiseButtonState(state)
|
||||
})
|
||||
}
|
||||
|
|
@ -594,7 +588,7 @@ func (w *WebviewWindow) SetMinimiseButtonState(state ButtonState) Window {
|
|||
func (w *WebviewWindow) SetMaximiseButtonState(state ButtonState) Window {
|
||||
w.options.MaximiseButtonState = state
|
||||
if w.impl != nil {
|
||||
InvokeAsync(func() {
|
||||
InvokeSync(func() {
|
||||
w.impl.setMaximiseButtonState(state)
|
||||
})
|
||||
}
|
||||
|
|
@ -604,7 +598,7 @@ func (w *WebviewWindow) SetMaximiseButtonState(state ButtonState) Window {
|
|||
func (w *WebviewWindow) SetCloseButtonState(state ButtonState) Window {
|
||||
w.options.CloseButtonState = state
|
||||
if w.impl != nil {
|
||||
InvokeAsync(func() {
|
||||
InvokeSync(func() {
|
||||
w.impl.setCloseButtonState(state)
|
||||
})
|
||||
}
|
||||
|
|
@ -614,17 +608,17 @@ func (w *WebviewWindow) SetCloseButtonState(state ButtonState) Window {
|
|||
// Flash flashes the window's taskbar button/icon.
|
||||
// Useful to indicate that attention is required. Windows only.
|
||||
func (w *WebviewWindow) Flash(enabled bool) {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
InvokeAsync(func() {
|
||||
InvokeSync(func() {
|
||||
w.impl.flash(enabled)
|
||||
})
|
||||
}
|
||||
|
||||
// IsMinimised returns true if the window is minimised
|
||||
func (w *WebviewWindow) IsMinimised() bool {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return false
|
||||
}
|
||||
return InvokeSyncWithResult(w.impl.isMinimised)
|
||||
|
|
@ -632,7 +626,7 @@ func (w *WebviewWindow) IsMinimised() bool {
|
|||
|
||||
// IsVisible returns true if the window is visible
|
||||
func (w *WebviewWindow) IsVisible() bool {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return false
|
||||
}
|
||||
return InvokeSyncWithResult(w.impl.isVisible)
|
||||
|
|
@ -640,7 +634,7 @@ func (w *WebviewWindow) IsVisible() bool {
|
|||
|
||||
// IsMaximised returns true if the window is maximised
|
||||
func (w *WebviewWindow) IsMaximised() bool {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return false
|
||||
}
|
||||
return InvokeSyncWithResult(w.impl.isMaximised)
|
||||
|
|
@ -648,7 +642,7 @@ func (w *WebviewWindow) IsMaximised() bool {
|
|||
|
||||
// Size returns the size of the window
|
||||
func (w *WebviewWindow) Size() (int, int) {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return 0, 0
|
||||
}
|
||||
var width, height int
|
||||
|
|
@ -660,7 +654,7 @@ func (w *WebviewWindow) Size() (int, int) {
|
|||
|
||||
// IsFocused returns true if the window is currently focused
|
||||
func (w *WebviewWindow) IsFocused() bool {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return false
|
||||
}
|
||||
return InvokeSyncWithResult(w.impl.isFocused)
|
||||
|
|
@ -668,7 +662,7 @@ func (w *WebviewWindow) IsFocused() bool {
|
|||
|
||||
// IsFullscreen returns true if the window is fullscreen
|
||||
func (w *WebviewWindow) IsFullscreen() bool {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return false
|
||||
}
|
||||
return InvokeSyncWithResult(w.impl.isFullscreen)
|
||||
|
|
@ -678,7 +672,7 @@ func (w *WebviewWindow) IsFullscreen() bool {
|
|||
func (w *WebviewWindow) SetBackgroundColour(colour RGBA) Window {
|
||||
w.options.BackgroundColour = colour
|
||||
if w.impl != nil {
|
||||
InvokeAsync(func() {
|
||||
InvokeSync(func() {
|
||||
w.impl.setBackgroundColour(colour)
|
||||
})
|
||||
}
|
||||
|
|
@ -690,7 +684,7 @@ func (w *WebviewWindow) HandleMessage(message string) {
|
|||
switch true {
|
||||
case message == "wails:drag":
|
||||
if !w.IsFullscreen() {
|
||||
InvokeAsync(func() {
|
||||
InvokeSync(func() {
|
||||
err := w.startDrag()
|
||||
if err != nil {
|
||||
w.Error("Failed to start drag: %s", err)
|
||||
|
|
@ -722,7 +716,7 @@ func (w *WebviewWindow) HandleMessage(message string) {
|
|||
}
|
||||
|
||||
func (w *WebviewWindow) startResize(border string) error {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return nil
|
||||
}
|
||||
return InvokeSyncWithResult(func() error {
|
||||
|
|
@ -732,11 +726,11 @@ func (w *WebviewWindow) startResize(border string) error {
|
|||
|
||||
// Center centers the window on the screen
|
||||
func (w *WebviewWindow) Center() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
w.options.InitialPosition = WindowCentered
|
||||
return
|
||||
}
|
||||
InvokeAsync(w.impl.center)
|
||||
InvokeSync(w.impl.center)
|
||||
}
|
||||
|
||||
// OnWindowEvent registers a callback for the given window event
|
||||
|
|
@ -803,7 +797,7 @@ func (w *WebviewWindow) HandleWindowEvent(id uint) {
|
|||
|
||||
// Width returns the width of the window
|
||||
func (w *WebviewWindow) Width() int {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return 0
|
||||
}
|
||||
return InvokeSyncWithResult(w.impl.width)
|
||||
|
|
@ -811,7 +805,7 @@ func (w *WebviewWindow) Width() int {
|
|||
|
||||
// Height returns the height of the window
|
||||
func (w *WebviewWindow) Height() int {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return 0
|
||||
}
|
||||
return InvokeSyncWithResult(w.impl.height)
|
||||
|
|
@ -819,7 +813,7 @@ func (w *WebviewWindow) Height() int {
|
|||
|
||||
// PhysicalBounds returns the physical bounds of the window
|
||||
func (w *WebviewWindow) PhysicalBounds() Rect {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return Rect{}
|
||||
}
|
||||
var rect Rect
|
||||
|
|
@ -831,7 +825,7 @@ func (w *WebviewWindow) PhysicalBounds() Rect {
|
|||
|
||||
// SetPhysicalBounds sets the physical bounds of the window
|
||||
func (w *WebviewWindow) SetPhysicalBounds(physicalBounds Rect) {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
InvokeSync(func() {
|
||||
|
|
@ -841,7 +835,7 @@ func (w *WebviewWindow) SetPhysicalBounds(physicalBounds Rect) {
|
|||
|
||||
// Bounds returns the DIP bounds of the window
|
||||
func (w *WebviewWindow) Bounds() Rect {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return Rect{}
|
||||
}
|
||||
var rect Rect
|
||||
|
|
@ -853,21 +847,21 @@ func (w *WebviewWindow) Bounds() Rect {
|
|||
|
||||
// SetBounds sets the DIP bounds of the window
|
||||
func (w *WebviewWindow) SetBounds(bounds Rect) {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
InvokeAsync(func() {
|
||||
InvokeSync(func() {
|
||||
w.impl.setBounds(bounds)
|
||||
})
|
||||
}
|
||||
|
||||
// Position returns the absolute position of the window
|
||||
func (w *WebviewWindow) Position() (int, int) {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return 0, 0
|
||||
}
|
||||
var x, y int
|
||||
InvokeAsync(func() {
|
||||
InvokeSync(func() {
|
||||
x, y = w.impl.position()
|
||||
})
|
||||
return x, y
|
||||
|
|
@ -875,17 +869,17 @@ func (w *WebviewWindow) Position() (int, int) {
|
|||
|
||||
// SetPosition sets the absolute position of the window.
|
||||
func (w *WebviewWindow) SetPosition(x int, y int) {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
InvokeAsync(func() {
|
||||
InvokeSync(func() {
|
||||
w.impl.setPosition(x, y)
|
||||
})
|
||||
}
|
||||
|
||||
// RelativePosition returns the position of the window relative to the screen WorkArea on which it is
|
||||
func (w *WebviewWindow) RelativePosition() (int, int) {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return 0, 0
|
||||
}
|
||||
var x, y int
|
||||
|
|
@ -907,8 +901,8 @@ func (w *WebviewWindow) SetRelativePosition(x, y int) Window {
|
|||
return w
|
||||
}
|
||||
|
||||
func (w *WebviewWindow) Destroy() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
func (w *WebviewWindow) destroy() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
|
||||
|
|
@ -922,7 +916,7 @@ func (w *WebviewWindow) Destroy() {
|
|||
|
||||
// Reload reloads the page assets
|
||||
func (w *WebviewWindow) Reload() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
InvokeSync(w.impl.reload)
|
||||
|
|
@ -930,7 +924,7 @@ func (w *WebviewWindow) Reload() {
|
|||
|
||||
// ForceReload forces the window to reload the page assets
|
||||
func (w *WebviewWindow) ForceReload() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
InvokeSync(w.impl.forceReload)
|
||||
|
|
@ -938,10 +932,10 @@ func (w *WebviewWindow) ForceReload() {
|
|||
|
||||
// ToggleFullscreen toggles the window between fullscreen and normal
|
||||
func (w *WebviewWindow) ToggleFullscreen() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
InvokeAsync(func() {
|
||||
InvokeSync(func() {
|
||||
if w.IsFullscreen() {
|
||||
w.UnFullscreen()
|
||||
} else {
|
||||
|
|
@ -952,10 +946,10 @@ func (w *WebviewWindow) ToggleFullscreen() {
|
|||
|
||||
// ToggleMaximise toggles the window between maximised and normal
|
||||
func (w *WebviewWindow) ToggleMaximise() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
InvokeAsync(func() {
|
||||
InvokeSync(func() {
|
||||
if w.IsMaximised() {
|
||||
w.UnMaximise()
|
||||
} else {
|
||||
|
|
@ -965,7 +959,7 @@ func (w *WebviewWindow) ToggleMaximise() {
|
|||
}
|
||||
|
||||
func (w *WebviewWindow) OpenDevTools() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
InvokeSync(w.impl.openDevTools)
|
||||
|
|
@ -975,53 +969,41 @@ func (w *WebviewWindow) OpenDevTools() {
|
|||
func (w *WebviewWindow) ZoomReset() Window {
|
||||
if w.impl != nil {
|
||||
InvokeSync(w.impl.zoomReset)
|
||||
w.emit(events.Common.WindowZoomReset)
|
||||
}
|
||||
return w
|
||||
|
||||
}
|
||||
|
||||
// ZoomIn increases the zoom level of the webview content
|
||||
func (w *WebviewWindow) ZoomIn() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
InvokeSync(func() {
|
||||
w.impl.zoomIn()
|
||||
w.emit(events.Common.WindowZoomIn)
|
||||
})
|
||||
InvokeSync(w.impl.zoomIn)
|
||||
}
|
||||
|
||||
// ZoomOut decreases the zoom level of the webview content
|
||||
func (w *WebviewWindow) ZoomOut() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
InvokeSync(func() {
|
||||
w.impl.zoomOut()
|
||||
w.emit(events.Common.WindowZoomOut)
|
||||
})
|
||||
InvokeSync(w.impl.zoomOut)
|
||||
}
|
||||
|
||||
// Close closes the window
|
||||
func (w *WebviewWindow) Close() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
InvokeAsync(func() {
|
||||
// w.impl.close() - Why wasn't this here?
|
||||
InvokeSync(func() {
|
||||
w.emit(events.Common.WindowClosing)
|
||||
})
|
||||
}
|
||||
|
||||
func (w *WebviewWindow) Zoom() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
InvokeSync(func() {
|
||||
w.impl.zoom()
|
||||
w.emit(events.Common.WindowZoom)
|
||||
})
|
||||
InvokeSync(w.impl.zoom)
|
||||
}
|
||||
|
||||
// SetHTML sets the HTML of the window to the given html string.
|
||||
|
|
@ -1037,79 +1019,58 @@ func (w *WebviewWindow) SetHTML(html string) Window {
|
|||
|
||||
// Minimise minimises the window.
|
||||
func (w *WebviewWindow) Minimise() Window {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
w.options.StartState = WindowStateMinimised
|
||||
return w
|
||||
}
|
||||
if !w.IsMinimised() {
|
||||
InvokeSync(func() {
|
||||
w.impl.minimise()
|
||||
w.emit(events.Common.WindowMinimise)
|
||||
})
|
||||
InvokeSync(w.impl.minimise)
|
||||
}
|
||||
return w
|
||||
}
|
||||
|
||||
// Maximise maximises the window. Min/Max size constraints are disabled.
|
||||
func (w *WebviewWindow) Maximise() Window {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
w.options.StartState = WindowStateMaximised
|
||||
return w
|
||||
}
|
||||
if !w.IsMaximised() {
|
||||
w.DisableSizeConstraints()
|
||||
InvokeSync(func() {
|
||||
w.impl.maximise()
|
||||
w.emit(events.Common.WindowMaximise)
|
||||
})
|
||||
InvokeSync(w.impl.maximise)
|
||||
}
|
||||
return w
|
||||
}
|
||||
|
||||
// UnMinimise un-minimises the window. Min/Max size constraints are re-enabled.
|
||||
func (w *WebviewWindow) UnMinimise() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
if w.IsMinimised() {
|
||||
InvokeSync(func() {
|
||||
w.impl.unminimise()
|
||||
w.emit(events.Common.WindowUnMinimise)
|
||||
})
|
||||
InvokeSync(w.impl.unminimise)
|
||||
}
|
||||
}
|
||||
|
||||
// UnMaximise un-maximises the window. Min/Max size constraints are re-enabled.
|
||||
func (w *WebviewWindow) UnMaximise() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
if w.IsMaximised() {
|
||||
w.EnableSizeConstraints()
|
||||
InvokeSync(func() {
|
||||
w.impl.unmaximise()
|
||||
w.emit(events.Common.WindowUnMaximise)
|
||||
})
|
||||
InvokeSync(w.impl.unmaximise)
|
||||
}
|
||||
}
|
||||
|
||||
// UnFullscreen un-fullscreens the window. Min/Max size constraints are re-enabled.
|
||||
func (w *WebviewWindow) UnFullscreen() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
if w.IsFullscreen() {
|
||||
w.EnableSizeConstraints()
|
||||
InvokeSync(func() {
|
||||
w.impl.unfullscreen()
|
||||
w.emit(events.Common.WindowUnFullscreen)
|
||||
})
|
||||
InvokeSync(w.impl.unfullscreen)
|
||||
}
|
||||
}
|
||||
|
||||
// Restore restores the window to its previous state if it was previously minimised, maximised or fullscreen.
|
||||
func (w *WebviewWindow) Restore() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
InvokeSync(func() {
|
||||
|
|
@ -1120,12 +1081,11 @@ func (w *WebviewWindow) Restore() {
|
|||
} else if w.IsMaximised() {
|
||||
w.UnMaximise()
|
||||
}
|
||||
w.emit(events.Common.WindowRestore)
|
||||
})
|
||||
}
|
||||
|
||||
func (w *WebviewWindow) DisableSizeConstraints() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
InvokeSync(func() {
|
||||
|
|
@ -1139,7 +1099,7 @@ func (w *WebviewWindow) DisableSizeConstraints() {
|
|||
}
|
||||
|
||||
func (w *WebviewWindow) EnableSizeConstraints() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
InvokeSync(func() {
|
||||
|
|
@ -1154,7 +1114,7 @@ func (w *WebviewWindow) EnableSizeConstraints() {
|
|||
|
||||
// GetScreen returns the screen that the window is on
|
||||
func (w *WebviewWindow) GetScreen() (*Screen, error) {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return nil, nil
|
||||
}
|
||||
return InvokeSyncWithResultAndError(w.impl.getScreen)
|
||||
|
|
@ -1220,10 +1180,10 @@ func (w *WebviewWindow) OpenContextMenu(data *ContextMenuData) {
|
|||
}
|
||||
}
|
||||
menu.setContextData(data)
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
InvokeAsync(func() {
|
||||
InvokeSync(func() {
|
||||
w.impl.openContextMenu(menu, data)
|
||||
})
|
||||
}
|
||||
|
|
@ -1237,7 +1197,7 @@ func (w *WebviewWindow) RegisterContextMenu(name string, menu *Menu) {
|
|||
|
||||
// NativeWindowHandle returns the platform native window handle for the window.
|
||||
func (w *WebviewWindow) NativeWindowHandle() (uintptr, error) {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return 0, errors.New("native handle unavailable as window is not running")
|
||||
}
|
||||
return w.impl.nativeWindowHandle(), nil
|
||||
|
|
@ -1245,7 +1205,6 @@ func (w *WebviewWindow) NativeWindowHandle() (uintptr, error) {
|
|||
|
||||
func (w *WebviewWindow) Focus() {
|
||||
InvokeSync(w.impl.focus)
|
||||
w.emit(events.Common.WindowFocus)
|
||||
}
|
||||
|
||||
func (w *WebviewWindow) emit(eventType events.WindowEventType) {
|
||||
|
|
@ -1256,21 +1215,21 @@ func (w *WebviewWindow) emit(eventType events.WindowEventType) {
|
|||
}
|
||||
|
||||
func (w *WebviewWindow) startDrag() error {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return nil
|
||||
}
|
||||
return InvokeSyncWithError(w.impl.startDrag)
|
||||
}
|
||||
|
||||
func (w *WebviewWindow) Print() error {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return nil
|
||||
}
|
||||
return InvokeSyncWithError(w.impl.print)
|
||||
}
|
||||
|
||||
func (w *WebviewWindow) SetEnabled(enabled bool) {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
InvokeSync(func() {
|
||||
|
|
@ -1304,7 +1263,7 @@ func (w *WebviewWindow) processKeyBinding(acceleratorString string) bool {
|
|||
}
|
||||
|
||||
func (w *WebviewWindow) HandleKeyEvent(acceleratorString string) {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return
|
||||
}
|
||||
InvokeSync(func() {
|
||||
|
|
@ -1331,7 +1290,7 @@ func (w *WebviewWindow) addMenuBinding(a *accelerator, menuItem *MenuItem) {
|
|||
}
|
||||
|
||||
func (w *WebviewWindow) IsIgnoreMouseEvents() bool {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return false
|
||||
}
|
||||
return InvokeSyncWithResult(w.impl.isIgnoreMouseEvents)
|
||||
|
|
@ -1339,7 +1298,7 @@ func (w *WebviewWindow) IsIgnoreMouseEvents() bool {
|
|||
|
||||
func (w *WebviewWindow) SetIgnoreMouseEvents(ignore bool) Window {
|
||||
w.options.IgnoreMouseEvents = ignore
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
return w
|
||||
}
|
||||
InvokeSync(func() {
|
||||
|
|
@ -1349,37 +1308,43 @@ func (w *WebviewWindow) SetIgnoreMouseEvents(ignore bool) Window {
|
|||
}
|
||||
|
||||
func (w *WebviewWindow) cut() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
w.impl.cut()
|
||||
}
|
||||
}
|
||||
|
||||
func (w *WebviewWindow) copy() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
w.impl.copy()
|
||||
}
|
||||
}
|
||||
|
||||
func (w *WebviewWindow) paste() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
w.impl.paste()
|
||||
}
|
||||
}
|
||||
|
||||
func (w *WebviewWindow) selectAll() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
w.impl.selectAll()
|
||||
}
|
||||
}
|
||||
|
||||
func (w *WebviewWindow) undo() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
w.impl.undo()
|
||||
}
|
||||
}
|
||||
|
||||
func (w *WebviewWindow) delete() {
|
||||
if w.impl == nil && !w.isDestroyed() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
w.impl.delete()
|
||||
}
|
||||
}
|
||||
|
||||
func (w *WebviewWindow) redo() {
|
||||
if w.impl == nil || w.isDestroyed() {
|
||||
w.impl.redo()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -956,6 +956,7 @@ func (w *macosWebviewWindow) windowZoom() {
|
|||
|
||||
func (w *macosWebviewWindow) close() {
|
||||
C.windowClose(w.nsWindow)
|
||||
// TODO: Check if we need to unregister the window here or not
|
||||
}
|
||||
|
||||
func (w *macosWebviewWindow) zoomIn() {
|
||||
|
|
|
|||
|
|
@ -193,6 +193,36 @@ extern bool hasListeners(unsigned int);
|
|||
}
|
||||
[super dealloc];
|
||||
}
|
||||
- (void)windowDidZoom:(NSNotification *)notification {
|
||||
NSWindow *window = notification.object;
|
||||
if ([window isZoomed]) {
|
||||
if (hasListeners(EventWindowMaximise)) {
|
||||
processWindowEvent(self.windowId, EventWindowMaximise);
|
||||
}
|
||||
} else {
|
||||
if (hasListeners(EventWindowUnMaximise)) {
|
||||
processWindowEvent(self.windowId, EventWindowUnMaximise);
|
||||
}
|
||||
}
|
||||
}
|
||||
- (void)performZoomIn:(id)sender {
|
||||
[super zoom:sender];
|
||||
if (hasListeners(EventWindowZoomIn)) {
|
||||
processWindowEvent(self.windowId, EventWindowZoomIn);
|
||||
}
|
||||
}
|
||||
- (void)performZoomOut:(id)sender {
|
||||
[super zoom:sender];
|
||||
if (hasListeners(EventWindowZoomOut)) {
|
||||
processWindowEvent(self.windowId, EventWindowZoomOut);
|
||||
}
|
||||
}
|
||||
- (void)performZoomReset:(id)sender {
|
||||
[self setFrame:[self frameRectForContentRect:[[self screen] visibleFrame]] display:YES];
|
||||
if (hasListeners(EventWindowZoomReset)) {
|
||||
processWindowEvent(self.windowId, EventWindowZoomReset);
|
||||
}
|
||||
}
|
||||
@end
|
||||
@implementation WebviewWindowDelegate
|
||||
- (BOOL)windowShouldClose:(NSWindow *)sender {
|
||||
|
|
@ -248,6 +278,13 @@ extern bool hasListeners(unsigned int);
|
|||
return proposedOptions | NSApplicationPresentationAutoHideToolbar;
|
||||
}
|
||||
}
|
||||
- (void)windowDidChangeVisibility:(NSNotification *)notification {
|
||||
NSWindow *window = notification.object;
|
||||
BOOL isVisible = ![window isVisible];
|
||||
if (hasListeners(isVisible ? EventWindowShow : EventWindowHide)) {
|
||||
processWindowEvent(self.windowId, isVisible ? EventWindowShow : EventWindowHide);
|
||||
}
|
||||
}
|
||||
// GENERATED EVENTS START
|
||||
- (void)windowDidBecomeKey:(NSNotification *)notification {
|
||||
if( hasListeners(EventWindowDidBecomeKey) ) {
|
||||
|
|
@ -369,12 +406,6 @@ extern bool hasListeners(unsigned int);
|
|||
}
|
||||
}
|
||||
|
||||
- (void)windowDidChangeVisibility:(NSNotification *)notification {
|
||||
if( hasListeners(EventWindowDidChangeVisibility) ) {
|
||||
processWindowEvent(self.windowId, EventWindowDidChangeVisibility);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)windowDidDeminiaturize:(NSNotification *)notification {
|
||||
if( hasListeners(EventWindowDidDeminiaturize) ) {
|
||||
processWindowEvent(self.windowId, EventWindowDidDeminiaturize);
|
||||
|
|
@ -393,6 +424,18 @@ extern bool hasListeners(unsigned int);
|
|||
}
|
||||
}
|
||||
|
||||
- (void)windowMaximise:(NSNotification *)notification {
|
||||
if( hasListeners(EventWindowMaximise) ) {
|
||||
processWindowEvent(self.windowId, EventWindowMaximise);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)windowUnMaximise:(NSNotification *)notification {
|
||||
if( hasListeners(EventWindowUnMaximise) ) {
|
||||
processWindowEvent(self.windowId, EventWindowUnMaximise);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)windowDidEnterVersionBrowser:(NSNotification *)notification {
|
||||
if( hasListeners(EventWindowDidEnterVersionBrowser) ) {
|
||||
processWindowEvent(self.windowId, EventWindowDidEnterVersionBrowser);
|
||||
|
|
@ -507,12 +550,6 @@ extern bool hasListeners(unsigned int);
|
|||
}
|
||||
}
|
||||
|
||||
- (void)windowDidUpdateVisibility:(NSNotification *)notification {
|
||||
if( hasListeners(EventWindowDidUpdateVisibility) ) {
|
||||
processWindowEvent(self.windowId, EventWindowDidUpdateVisibility);
|
||||
}
|
||||
}
|
||||
|
||||
- (void)windowWillBecomeKey:(NSNotification *)notification {
|
||||
if( hasListeners(EventWindowWillBecomeKey) ) {
|
||||
processWindowEvent(self.windowId, EventWindowWillBecomeKey);
|
||||
|
|
@ -719,7 +756,6 @@ extern bool hasListeners(unsigned int);
|
|||
|
||||
// GENERATED EVENTS END
|
||||
@end
|
||||
|
||||
void windowSetScreen(void* window, void* screen, int yOffset) {
|
||||
WebviewWindow* nsWindow = (WebviewWindow*)window;
|
||||
NSScreen* nsScreen = (NSScreen*)screen;
|
||||
|
|
|
|||
|
|
@ -13,10 +13,6 @@ import (
|
|||
"github.com/wailsapp/wails/v3/pkg/events"
|
||||
)
|
||||
|
||||
const (
|
||||
windowDidMoveDebounceMS = 200
|
||||
)
|
||||
|
||||
type dragInfo struct {
|
||||
XRoot int
|
||||
YRoot int
|
||||
|
|
@ -240,10 +236,18 @@ func (w *linuxWebviewWindow) run() {
|
|||
}
|
||||
|
||||
if w.moveDebouncer == nil {
|
||||
w.moveDebouncer = debounce.New(time.Duration(windowDidMoveDebounceMS) * time.Millisecond)
|
||||
debounceMS := w.parent.options.Linux.WindowDidMoveDebounceMS
|
||||
if debounceMS == 0 {
|
||||
debounceMS = 50 // Default value
|
||||
}
|
||||
w.moveDebouncer = debounce.New(time.Duration(debounceMS) * time.Millisecond)
|
||||
}
|
||||
if w.resizeDebouncer == nil {
|
||||
w.resizeDebouncer = debounce.New(time.Duration(windowDidMoveDebounceMS) * time.Millisecond)
|
||||
debounceMS := w.parent.options.Linux.WindowDidMoveDebounceMS
|
||||
if debounceMS == 0 {
|
||||
debounceMS = 50 // Default value
|
||||
}
|
||||
w.resizeDebouncer = debounce.New(time.Duration(debounceMS) * time.Millisecond)
|
||||
}
|
||||
|
||||
// Register the capabilities
|
||||
|
|
|
|||
|
|
@ -128,10 +128,6 @@ type WebviewWindowOptions struct {
|
|||
MaximiseButtonState ButtonState
|
||||
CloseButtonState ButtonState
|
||||
|
||||
// ShouldClose is called when the window is about to close.
|
||||
// Return true to allow the window to close, or false to prevent it from closing.
|
||||
ShouldClose func(window *WebviewWindow) bool
|
||||
|
||||
// If true, the window's devtools will be available (default true in builds without the `production` build tag)
|
||||
DevToolsEnabled bool
|
||||
|
||||
|
|
@ -252,6 +248,16 @@ type WindowsWindow struct {
|
|||
// Default: false
|
||||
WindowMaskDraggable bool
|
||||
|
||||
// ResizeDebounceMS is the amount of time to debounce redraws of webview2
|
||||
// when resizing the window
|
||||
// Default: 0
|
||||
ResizeDebounceMS uint16
|
||||
|
||||
// WindowDidMoveDebounceMS is the amount of time to debounce the WindowDidMove event
|
||||
// when moving the window
|
||||
// Default: 0
|
||||
WindowDidMoveDebounceMS uint16
|
||||
|
||||
// Disable the menu bar for this window
|
||||
// Default: false
|
||||
DisableMenu bool
|
||||
|
|
@ -525,4 +531,7 @@ type LinuxWindow struct {
|
|||
// Client code may override this behavior by passing a non-nil Options and set
|
||||
// WebviewGpuPolicy as needed.
|
||||
WebviewGpuPolicy WebviewGpuPolicy
|
||||
|
||||
// WindowDidMoveDebounceMS is the debounce time in milliseconds for the WindowDidMove event
|
||||
WindowDidMoveDebounceMS uint16
|
||||
}
|
||||
|
|
|
|||
|
|
@ -28,10 +28,6 @@ import (
|
|||
"github.com/wailsapp/wails/v3/pkg/w32"
|
||||
)
|
||||
|
||||
const (
|
||||
windowDidMoveDebounceMS = 200
|
||||
)
|
||||
|
||||
var edgeMap = map[string]uintptr{
|
||||
"n-resize": w32.HTTOP,
|
||||
"ne-resize": w32.HTTOPRIGHT,
|
||||
|
|
@ -58,8 +54,8 @@ type windowsWebviewWindow struct {
|
|||
previousWindowPlacement w32.WINDOWPLACEMENT
|
||||
|
||||
// Webview
|
||||
chromium *edge.Chromium
|
||||
hasStarted bool
|
||||
chromium *edge.Chromium
|
||||
webviewNavigationCompleted bool
|
||||
|
||||
// resizeBorder* is the width/height of the resize border in pixels.
|
||||
resizeBorderWidth int32
|
||||
|
|
@ -69,7 +65,9 @@ type windowsWebviewWindow struct {
|
|||
onceDo sync.Once
|
||||
|
||||
// Window move debouncer
|
||||
moveDebouncer func(func())
|
||||
moveDebouncer func(func())
|
||||
resizeDebouncer func(func())
|
||||
|
||||
// isMinimizing indicates whether the window is currently being minimized
|
||||
// Used to prevent unnecessary redraws during minimize/restore operations
|
||||
isMinimizing bool
|
||||
|
|
@ -153,6 +151,7 @@ func (w *windowsWebviewWindow) setAlwaysOnTop(alwaysOnTop bool) {
|
|||
|
||||
func (w *windowsWebviewWindow) setURL(url string) {
|
||||
// Navigate to the given URL in the webview
|
||||
w.webviewNavigationCompleted = false
|
||||
w.chromium.Navigate(url)
|
||||
}
|
||||
|
||||
|
|
@ -209,7 +208,8 @@ func (w *windowsWebviewWindow) run() {
|
|||
}
|
||||
// If we're frameless, we need to add the WS_EX_TOOLWINDOW style to hide the window from the taskbar
|
||||
if options.Windows.HiddenOnTaskbar {
|
||||
exStyle |= w32.WS_EX_TOOLWINDOW
|
||||
//exStyle |= w32.WS_EX_TOOLWINDOW
|
||||
exStyle |= w32.WS_EX_NOACTIVATE
|
||||
} else {
|
||||
exStyle |= w32.WS_EX_APPWINDOW
|
||||
}
|
||||
|
|
@ -282,6 +282,15 @@ func (w *windowsWebviewWindow) run() {
|
|||
|
||||
w.setupChromium()
|
||||
|
||||
if options.Windows.WindowDidMoveDebounceMS == 0 {
|
||||
options.Windows.WindowDidMoveDebounceMS = 50
|
||||
}
|
||||
w.moveDebouncer = debounce.New(time.Duration(options.Windows.WindowDidMoveDebounceMS) * time.Millisecond)
|
||||
|
||||
if options.Windows.ResizeDebounceMS > 0 {
|
||||
w.resizeDebouncer = debounce.New(time.Duration(options.Windows.ResizeDebounceMS) * time.Millisecond)
|
||||
}
|
||||
|
||||
// Initialise the window buttons
|
||||
w.setMinimiseButtonState(options.MinimiseButtonState)
|
||||
w.setMaximiseButtonState(options.MaximiseButtonState)
|
||||
|
|
@ -382,11 +391,6 @@ func (w *windowsWebviewWindow) run() {
|
|||
// Trigger a resize to ensure the window is sized correctly
|
||||
w.chromium.Resize()
|
||||
}
|
||||
|
||||
if !options.Hidden {
|
||||
w.parent.Show()
|
||||
w.update()
|
||||
}
|
||||
}
|
||||
|
||||
func (w *windowsWebviewWindow) center() {
|
||||
|
|
@ -523,7 +527,7 @@ func (w *windowsWebviewWindow) destroy() {
|
|||
if w.dropTarget != nil {
|
||||
w.dropTarget.Release()
|
||||
}
|
||||
// Destroy the window
|
||||
// destroy the window
|
||||
w32.DestroyWindow(w.hwnd)
|
||||
}
|
||||
|
||||
|
|
@ -577,9 +581,7 @@ func (w *windowsWebviewWindow) setZoom(zoom float64) {
|
|||
}
|
||||
|
||||
func (w *windowsWebviewWindow) close() {
|
||||
// Unregister the window with the application
|
||||
windowsApp := globalApplication.impl.(*windowsApp)
|
||||
windowsApp.unregisterWindow(w)
|
||||
// Send WM_CLOSE message to trigger the same flow as clicking the X button
|
||||
w32.SendMessage(w.hwnd, w32.WM_CLOSE, 0, 0)
|
||||
}
|
||||
|
||||
|
|
@ -873,7 +875,10 @@ func (w *windowsWebviewWindow) printStyle() {
|
|||
}
|
||||
|
||||
func (w *windowsWebviewWindow) show() {
|
||||
w32.ShowWindow(w.hwnd, w32.SW_SHOW)
|
||||
if w.webviewNavigationCompleted {
|
||||
w.chromium.Show()
|
||||
w32.ShowWindow(w.hwnd, w32.SW_SHOW)
|
||||
}
|
||||
}
|
||||
|
||||
func (w *windowsWebviewWindow) hide() {
|
||||
|
|
@ -1033,8 +1038,23 @@ func (w *windowsWebviewWindow) WndProc(msg uint32, wparam, lparam uintptr) uintp
|
|||
}
|
||||
}
|
||||
case w32.WM_CLOSE:
|
||||
w.parent.emit(events.Windows.WindowClose)
|
||||
return 0
|
||||
|
||||
if w.parent.unconditionallyClose == false {
|
||||
// We were called by `Close()` or pressing the close button on the window
|
||||
w.parent.emit(events.Windows.WindowClosing)
|
||||
return 0
|
||||
}
|
||||
|
||||
defer func() {
|
||||
windowsApp := globalApplication.impl.(*windowsApp)
|
||||
windowsApp.unregisterWindow(w)
|
||||
|
||||
}()
|
||||
|
||||
// Now do the actual close
|
||||
w.chromium.ShuttingDown()
|
||||
return w32.DefWindowProc(w.hwnd, w32.WM_CLOSE, 0, 0)
|
||||
|
||||
case w32.WM_KILLFOCUS:
|
||||
if w.focusingChromium {
|
||||
return 0
|
||||
|
|
@ -1043,20 +1063,49 @@ func (w *windowsWebviewWindow) WndProc(msg uint32, wparam, lparam uintptr) uintp
|
|||
case w32.WM_ENTERSIZEMOVE:
|
||||
// This is needed to close open dropdowns when moving the window https://github.com/MicrosoftEdge/WebView2Feedback/issues/2290
|
||||
w32.SetFocus(w.hwnd)
|
||||
if int(w32.GetKeyState(w32.VK_LBUTTON))&(0x8000) != 0 {
|
||||
// Left mouse button is down - window is being moved
|
||||
w.parent.emit(events.Windows.WindowStartMove)
|
||||
} else {
|
||||
// Window is being resized
|
||||
w.parent.emit(events.Windows.WindowStartResize)
|
||||
}
|
||||
case w32.WM_EXITSIZEMOVE:
|
||||
if int(w32.GetKeyState(w32.VK_LBUTTON))&0x8000 != 0 {
|
||||
w.parent.emit(events.Windows.WindowEndMove)
|
||||
} else {
|
||||
w.parent.emit(events.Windows.WindowEndResize)
|
||||
}
|
||||
case w32.WM_SETFOCUS:
|
||||
w.focus()
|
||||
w.parent.emit(events.Windows.WindowSetFocus)
|
||||
case w32.WM_MOVE, w32.WM_MOVING:
|
||||
_ = w.chromium.NotifyParentWindowPositionChanged()
|
||||
if w.moveDebouncer == nil {
|
||||
w.moveDebouncer = debounce.New(time.Duration(windowDidMoveDebounceMS) * time.Millisecond)
|
||||
}
|
||||
w.moveDebouncer(func() {
|
||||
w.parent.emit(events.Windows.WindowDidMove)
|
||||
})
|
||||
case w32.WM_SHOWWINDOW:
|
||||
if wparam == 1 {
|
||||
w.parent.emit(events.Windows.WindowShow)
|
||||
} else {
|
||||
w.parent.emit(events.Windows.WindowHide)
|
||||
}
|
||||
case w32.WM_WINDOWPOSCHANGED:
|
||||
windowPos := (*w32.WINDOWPOS)(unsafe.Pointer(lparam))
|
||||
if windowPos.Flags&w32.SWP_NOZORDER == 0 {
|
||||
w.parent.emit(events.Windows.WindowZOrderChanged)
|
||||
}
|
||||
case w32.WM_PAINT:
|
||||
w.parent.emit(events.Windows.WindowPaint)
|
||||
case w32.WM_ERASEBKGND:
|
||||
w.parent.emit(events.Windows.WindowBackgroundErase)
|
||||
return 1 // Let WebView2 handle background erasing
|
||||
// Check for keypress
|
||||
case w32.WM_KEYDOWN:
|
||||
w.processKeyBinding(uint(wparam))
|
||||
w.parent.emit(events.Windows.WindowKeyDown)
|
||||
case w32.WM_KEYUP:
|
||||
w.parent.emit(events.Windows.WindowKeyUp)
|
||||
case w32.WM_SIZE:
|
||||
switch wparam {
|
||||
case w32.SIZE_MAXIMIZED:
|
||||
|
|
@ -1069,22 +1118,34 @@ func (w *windowsWebviewWindow) WndProc(msg uint32, wparam, lparam uintptr) uintp
|
|||
w.parent.emit(events.Windows.WindowMinimise)
|
||||
}
|
||||
|
||||
doResize := func() {
|
||||
// Get the new size from lparam
|
||||
width := int32(lparam & 0xFFFF)
|
||||
height := int32((lparam >> 16) & 0xFFFF)
|
||||
bounds := &edge.Rect{
|
||||
Left: 0,
|
||||
Top: 0,
|
||||
Right: width,
|
||||
Bottom: height,
|
||||
}
|
||||
InvokeSync(func() {
|
||||
time.Sleep(1 * time.Nanosecond)
|
||||
w.chromium.ResizeWithBounds(bounds)
|
||||
atomic.StoreInt32(&resizePending, 0)
|
||||
w.parent.emit(events.Windows.WindowDidResize)
|
||||
})
|
||||
}
|
||||
|
||||
if w.parent.options.Frameless && wparam == w32.SIZE_MINIMIZED {
|
||||
// If the window is frameless, and we are minimizing, then we need to suppress the Resize on the
|
||||
// WebView2. If we don't do this, restoring does not work as expected and first restores with some wrong
|
||||
// size during the restore animation and only fully renders when the animation is done. This highly
|
||||
// depends on the content in the WebView, see https://github.com/wailsapp/wails/issues/1319
|
||||
// depends on the content in the WebView, see https://github.com/MicrosoftEdge/WebView2Feedback/issues/2549
|
||||
} else if w.resizeDebouncer != nil {
|
||||
w.resizeDebouncer(doResize)
|
||||
} else {
|
||||
if atomic.CompareAndSwapInt32(&resizePending, 0, 1) {
|
||||
go func() {
|
||||
// Wait for next vsync-like interval
|
||||
time.Sleep(time.Millisecond) // ~60fps timing
|
||||
InvokeSync(func() {
|
||||
w.chromium.Resize()
|
||||
atomic.StoreInt32(&resizePending, 0)
|
||||
w.parent.emit(events.Windows.WindowDidResize)
|
||||
})
|
||||
}()
|
||||
doResize()
|
||||
}
|
||||
}
|
||||
return 0
|
||||
|
|
@ -1144,7 +1205,16 @@ func (w *windowsWebviewWindow) WndProc(msg uint32, wparam, lparam uintptr) uintp
|
|||
if w.parent.options.Windows.WindowMaskDraggable {
|
||||
return w32.HTCAPTION
|
||||
}
|
||||
w.parent.emit(events.Windows.WindowNonClientHit)
|
||||
return w32.HTCLIENT
|
||||
case w32.WM_NCLBUTTONDOWN:
|
||||
w.parent.emit(events.Windows.WindowNonClientMouseDown)
|
||||
case w32.WM_NCLBUTTONUP:
|
||||
w.parent.emit(events.Windows.WindowNonClientMouseUp)
|
||||
case w32.WM_NCMOUSEMOVE:
|
||||
w.parent.emit(events.Windows.WindowNonClientMouseMove)
|
||||
case w32.WM_NCMOUSELEAVE:
|
||||
w.parent.emit(events.Windows.WindowNonClientMouseLeave)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -1431,12 +1501,6 @@ func (w *windowsWebviewWindow) setupChromium() {
|
|||
chromium.AdditionalBrowserArgs = append(chromium.AdditionalBrowserArgs, arg)
|
||||
}
|
||||
|
||||
////enableFeatures := []string{"msWebView2BrowserHitTransparent"}
|
||||
//if len(enableFeatures) > 0 {
|
||||
// arg := fmt.Sprintf("--enable-features=%s", strings.Join(enableFeatures, ","))
|
||||
// chromium.AdditionalBrowserArgs = append(chromium.AdditionalBrowserArgs, arg)
|
||||
//}
|
||||
|
||||
chromium.DataPath = globalApplication.options.Windows.WebviewUserDataPath
|
||||
chromium.BrowserPath = globalApplication.options.Windows.WebviewBrowserPath
|
||||
|
||||
|
|
@ -1533,14 +1597,6 @@ func (w *windowsWebviewWindow) setupChromium() {
|
|||
}
|
||||
}
|
||||
|
||||
// event mapping
|
||||
w.parent.OnWindowEvent(events.Windows.WindowDidMove, func(e *WindowEvent) {
|
||||
w.parent.emit(events.Common.WindowDidMove)
|
||||
})
|
||||
w.parent.OnWindowEvent(events.Windows.WindowDidResize, func(e *WindowEvent) {
|
||||
w.parent.emit(events.Common.WindowDidResize)
|
||||
})
|
||||
|
||||
// We will get round to this
|
||||
//if chromium.HasCapability(edge.AllowExternalDrop) {
|
||||
// err := chromium.AllowExternalDrag(w.parent.options.EnableDragAndDrop)
|
||||
|
|
@ -1594,6 +1650,7 @@ func (w *windowsWebviewWindow) setupChromium() {
|
|||
|
||||
// Set background colour
|
||||
w.setBackgroundColour(w.parent.options.BackgroundColour)
|
||||
chromium.SetBackgroundColour(w.parent.options.BackgroundColour.Red, w.parent.options.BackgroundColour.Green, w.parent.options.BackgroundColour.Blue, w.parent.options.BackgroundColour.Alpha)
|
||||
|
||||
chromium.SetGlobalPermission(edge.CoreWebView2PermissionStateAllow)
|
||||
chromium.AddWebResourceRequestedFilter("*", edge.COREWEBVIEW2_WEB_RESOURCE_CONTEXT_ALL)
|
||||
|
|
@ -1613,6 +1670,7 @@ func (w *windowsWebviewWindow) setupChromium() {
|
|||
if err != nil {
|
||||
globalApplication.fatal(err.Error())
|
||||
}
|
||||
w.webviewNavigationCompleted = false
|
||||
chromium.Navigate(startURL)
|
||||
}
|
||||
|
||||
|
|
@ -1655,12 +1713,12 @@ func (w *windowsWebviewWindow) navigationCompleted(sender *edge.ICoreWebView2, a
|
|||
// EmitEvent DomReady ApplicationEvent
|
||||
windowEvents <- &windowEvent{EventID: uint(events.Windows.WebViewNavigationCompleted), WindowID: w.parent.id}
|
||||
|
||||
if w.hasStarted {
|
||||
if w.webviewNavigationCompleted {
|
||||
// NavigationCompleted is triggered for every Load. If an application uses reloads the Hide/Show will trigger
|
||||
// a flickering of the window with every reload. So we only do this once for the first NavigationCompleted.
|
||||
return
|
||||
}
|
||||
w.hasStarted = true
|
||||
w.webviewNavigationCompleted = true
|
||||
|
||||
wasFocused := w.isFocused()
|
||||
// Hack to make it visible: https://github.com/MicrosoftEdge/WebView2Feedback/issues/1077#issuecomment-825375026
|
||||
|
|
@ -1675,9 +1733,10 @@ func (w *windowsWebviewWindow) navigationCompleted(sender *edge.ICoreWebView2, a
|
|||
if wasFocused {
|
||||
w.focus()
|
||||
}
|
||||
|
||||
//f.mainWindow.hasBeenShown = true
|
||||
|
||||
if !w.parent.options.Hidden {
|
||||
w.parent.Show()
|
||||
w.update()
|
||||
}
|
||||
}
|
||||
|
||||
func (w *windowsWebviewWindow) processKeyBinding(vkey uint) bool {
|
||||
|
|
|
|||
|
|
@ -15,7 +15,6 @@ type Window interface {
|
|||
Callback
|
||||
Center()
|
||||
Close()
|
||||
Destroy()
|
||||
DisableSizeConstraints()
|
||||
DispatchWailsEvent(event *CustomEvent)
|
||||
EmitEvent(name string, data ...any)
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ import "runtime"
|
|||
|
||||
var defaultWindowEventMapping = map[string]map[WindowEventType]WindowEventType{
|
||||
"windows": {
|
||||
Windows.WindowClose: Common.WindowClosing,
|
||||
Windows.WindowClosing: Common.WindowClosing,
|
||||
Windows.WindowInactive: Common.WindowLostFocus,
|
||||
Windows.WindowClickActive: Common.WindowFocus,
|
||||
Windows.WindowActive: Common.WindowFocus,
|
||||
|
|
@ -15,17 +15,38 @@ var defaultWindowEventMapping = map[string]map[WindowEventType]WindowEventType{
|
|||
Windows.WindowUnMinimise: Common.WindowUnMinimise,
|
||||
Windows.WindowFullscreen: Common.WindowFullscreen,
|
||||
Windows.WindowUnFullscreen: Common.WindowUnFullscreen,
|
||||
Windows.WindowShow: Common.WindowShow,
|
||||
Windows.WindowHide: Common.WindowHide,
|
||||
Windows.WindowDidMove: Common.WindowDidMove,
|
||||
Windows.WindowDidResize: Common.WindowDidResize,
|
||||
Windows.WindowSetFocus: Common.WindowFocus,
|
||||
Windows.WindowKillFocus: Common.WindowLostFocus,
|
||||
},
|
||||
"darwin": {
|
||||
Mac.WindowDidResignKey: Common.WindowLostFocus,
|
||||
Mac.WindowDidResignKey: Common.WindowLostFocus,
|
||||
Mac.WindowDidBecomeKey: Common.WindowFocus,
|
||||
Mac.WindowDidMiniaturize: Common.WindowMinimise,
|
||||
Mac.WindowDidDeminiaturize: Common.WindowUnMinimise,
|
||||
Mac.WindowDidEnterFullScreen: Common.WindowFullscreen,
|
||||
Mac.WindowDidExitFullScreen: Common.WindowUnFullscreen,
|
||||
Mac.WindowMaximise: Common.WindowMaximise,
|
||||
Mac.WindowUnMaximise: Common.WindowUnMaximise,
|
||||
Mac.WindowDidMove: Common.WindowDidMove,
|
||||
Mac.WindowDidResize: Common.WindowDidResize,
|
||||
Mac.WindowDidUpdate: Common.WindowShow,
|
||||
Mac.WindowDidZoom: Common.WindowMaximise,
|
||||
Mac.WindowZoomIn: Common.WindowZoomIn,
|
||||
Mac.WindowZoomOut: Common.WindowZoomOut,
|
||||
Mac.WindowZoomReset: Common.WindowZoomReset,
|
||||
},
|
||||
"linux": {
|
||||
Linux.WindowDeleteEvent: Common.WindowClosing,
|
||||
Linux.WindowFocusIn: Common.WindowFocus,
|
||||
Linux.WindowFocusOut: Common.WindowLostFocus,
|
||||
Linux.WindowDidMove: Common.WindowDidMove,
|
||||
Linux.WindowDidResize: Common.WindowDidResize,
|
||||
Linux.WindowLoadChanged: Common.WindowShow,
|
||||
},
|
||||
"linux": {},
|
||||
}
|
||||
|
||||
func DefaultWindowEventMapping() map[WindowEventType]WindowEventType {
|
||||
|
|
|
|||
|
|
@ -34,30 +34,30 @@ type commonEvents struct {
|
|||
|
||||
func newCommonEvents() commonEvents {
|
||||
return commonEvents{
|
||||
ApplicationStarted: 1183,
|
||||
WindowMaximise: 1184,
|
||||
WindowUnMaximise: 1185,
|
||||
WindowFullscreen: 1186,
|
||||
WindowUnFullscreen: 1187,
|
||||
WindowRestore: 1188,
|
||||
WindowMinimise: 1189,
|
||||
WindowUnMinimise: 1190,
|
||||
WindowClosing: 1191,
|
||||
WindowZoom: 1192,
|
||||
WindowZoomIn: 1193,
|
||||
WindowZoomOut: 1194,
|
||||
WindowZoomReset: 1195,
|
||||
WindowFocus: 1196,
|
||||
WindowLostFocus: 1197,
|
||||
WindowShow: 1198,
|
||||
WindowHide: 1199,
|
||||
WindowDPIChanged: 1200,
|
||||
WindowFilesDropped: 1201,
|
||||
WindowRuntimeReady: 1202,
|
||||
ThemeChanged: 1203,
|
||||
WindowDidMove: 1204,
|
||||
WindowDidResize: 1205,
|
||||
ApplicationOpenedWithFile: 1206,
|
||||
ApplicationStarted: 1203,
|
||||
WindowMaximise: 1204,
|
||||
WindowUnMaximise: 1205,
|
||||
WindowFullscreen: 1206,
|
||||
WindowUnFullscreen: 1207,
|
||||
WindowRestore: 1208,
|
||||
WindowMinimise: 1209,
|
||||
WindowUnMinimise: 1210,
|
||||
WindowClosing: 1211,
|
||||
WindowZoom: 1212,
|
||||
WindowZoomIn: 1213,
|
||||
WindowZoomOut: 1214,
|
||||
WindowZoomReset: 1215,
|
||||
WindowFocus: 1216,
|
||||
WindowLostFocus: 1217,
|
||||
WindowShow: 1218,
|
||||
WindowHide: 1219,
|
||||
WindowDPIChanged: 1220,
|
||||
WindowFilesDropped: 1221,
|
||||
WindowRuntimeReady: 1222,
|
||||
ThemeChanged: 1223,
|
||||
WindowDidMove: 1224,
|
||||
WindowDidResize: 1225,
|
||||
ApplicationOpenedWithFile: 1226,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -132,10 +132,15 @@ type macEvents struct {
|
|||
WindowDidChangeSpaceOrderingMode WindowEventType
|
||||
WindowDidChangeTitle WindowEventType
|
||||
WindowDidChangeToolbar WindowEventType
|
||||
WindowDidChangeVisibility WindowEventType
|
||||
WindowDidDeminiaturize WindowEventType
|
||||
WindowDidEndSheet WindowEventType
|
||||
WindowDidEnterFullScreen WindowEventType
|
||||
WindowMaximise WindowEventType
|
||||
WindowUnMaximise WindowEventType
|
||||
WindowDidZoom WindowEventType
|
||||
WindowZoomIn WindowEventType
|
||||
WindowZoomOut WindowEventType
|
||||
WindowZoomReset WindowEventType
|
||||
WindowDidEnterVersionBrowser WindowEventType
|
||||
WindowDidExitFullScreen WindowEventType
|
||||
WindowDidExitVersionBrowser WindowEventType
|
||||
|
|
@ -155,7 +160,6 @@ type macEvents struct {
|
|||
WindowDidUpdateShadow WindowEventType
|
||||
WindowDidUpdateTitle WindowEventType
|
||||
WindowDidUpdateToolbar WindowEventType
|
||||
WindowDidUpdateVisibility WindowEventType
|
||||
WindowShouldClose WindowEventType
|
||||
WindowWillBecomeKey WindowEventType
|
||||
WindowWillBecomeMain WindowEventType
|
||||
|
|
@ -260,88 +264,92 @@ func newMacEvents() macEvents {
|
|||
WindowDidChangeSpaceOrderingMode: 1071,
|
||||
WindowDidChangeTitle: 1072,
|
||||
WindowDidChangeToolbar: 1073,
|
||||
WindowDidChangeVisibility: 1074,
|
||||
WindowDidDeminiaturize: 1075,
|
||||
WindowDidEndSheet: 1076,
|
||||
WindowDidEnterFullScreen: 1077,
|
||||
WindowDidEnterVersionBrowser: 1078,
|
||||
WindowDidExitFullScreen: 1079,
|
||||
WindowDidExitVersionBrowser: 1080,
|
||||
WindowDidExpose: 1081,
|
||||
WindowDidFocus: 1082,
|
||||
WindowDidMiniaturize: 1083,
|
||||
WindowDidMove: 1084,
|
||||
WindowDidOrderOffScreen: 1085,
|
||||
WindowDidOrderOnScreen: 1086,
|
||||
WindowDidResignKey: 1087,
|
||||
WindowDidResignMain: 1088,
|
||||
WindowDidResize: 1089,
|
||||
WindowDidUpdate: 1090,
|
||||
WindowDidUpdateAlpha: 1091,
|
||||
WindowDidUpdateCollectionBehavior: 1092,
|
||||
WindowDidUpdateCollectionProperties: 1093,
|
||||
WindowDidUpdateShadow: 1094,
|
||||
WindowDidUpdateTitle: 1095,
|
||||
WindowDidUpdateToolbar: 1096,
|
||||
WindowDidUpdateVisibility: 1097,
|
||||
WindowShouldClose: 1098,
|
||||
WindowWillBecomeKey: 1099,
|
||||
WindowWillBecomeMain: 1100,
|
||||
WindowWillBeginSheet: 1101,
|
||||
WindowWillChangeOrderingMode: 1102,
|
||||
WindowWillClose: 1103,
|
||||
WindowWillDeminiaturize: 1104,
|
||||
WindowWillEnterFullScreen: 1105,
|
||||
WindowWillEnterVersionBrowser: 1106,
|
||||
WindowWillExitFullScreen: 1107,
|
||||
WindowWillExitVersionBrowser: 1108,
|
||||
WindowWillFocus: 1109,
|
||||
WindowWillMiniaturize: 1110,
|
||||
WindowWillMove: 1111,
|
||||
WindowWillOrderOffScreen: 1112,
|
||||
WindowWillOrderOnScreen: 1113,
|
||||
WindowWillResignMain: 1114,
|
||||
WindowWillResize: 1115,
|
||||
WindowWillUnfocus: 1116,
|
||||
WindowWillUpdate: 1117,
|
||||
WindowWillUpdateAlpha: 1118,
|
||||
WindowWillUpdateCollectionBehavior: 1119,
|
||||
WindowWillUpdateCollectionProperties: 1120,
|
||||
WindowWillUpdateShadow: 1121,
|
||||
WindowWillUpdateTitle: 1122,
|
||||
WindowWillUpdateToolbar: 1123,
|
||||
WindowWillUpdateVisibility: 1124,
|
||||
WindowWillUseStandardFrame: 1125,
|
||||
MenuWillOpen: 1126,
|
||||
MenuDidOpen: 1127,
|
||||
MenuDidClose: 1128,
|
||||
MenuWillSendAction: 1129,
|
||||
MenuDidSendAction: 1130,
|
||||
MenuWillHighlightItem: 1131,
|
||||
MenuDidHighlightItem: 1132,
|
||||
MenuWillDisplayItem: 1133,
|
||||
MenuDidDisplayItem: 1134,
|
||||
MenuWillAddItem: 1135,
|
||||
MenuDidAddItem: 1136,
|
||||
MenuWillRemoveItem: 1137,
|
||||
MenuDidRemoveItem: 1138,
|
||||
MenuWillBeginTracking: 1139,
|
||||
MenuDidBeginTracking: 1140,
|
||||
MenuWillEndTracking: 1141,
|
||||
MenuDidEndTracking: 1142,
|
||||
MenuWillUpdate: 1143,
|
||||
MenuDidUpdate: 1144,
|
||||
MenuWillPopUp: 1145,
|
||||
MenuDidPopUp: 1146,
|
||||
MenuWillSendActionToItem: 1147,
|
||||
MenuDidSendActionToItem: 1148,
|
||||
WebViewDidStartProvisionalNavigation: 1149,
|
||||
WebViewDidReceiveServerRedirectForProvisionalNavigation: 1150,
|
||||
WebViewDidFinishNavigation: 1151,
|
||||
WebViewDidCommitNavigation: 1152,
|
||||
WindowFileDraggingEntered: 1153,
|
||||
WindowFileDraggingPerformed: 1154,
|
||||
WindowFileDraggingExited: 1155,
|
||||
WindowDidDeminiaturize: 1074,
|
||||
WindowDidEndSheet: 1075,
|
||||
WindowDidEnterFullScreen: 1076,
|
||||
WindowMaximise: 1077,
|
||||
WindowUnMaximise: 1078,
|
||||
WindowDidZoom: 1079,
|
||||
WindowZoomIn: 1080,
|
||||
WindowZoomOut: 1081,
|
||||
WindowZoomReset: 1082,
|
||||
WindowDidEnterVersionBrowser: 1083,
|
||||
WindowDidExitFullScreen: 1084,
|
||||
WindowDidExitVersionBrowser: 1085,
|
||||
WindowDidExpose: 1086,
|
||||
WindowDidFocus: 1087,
|
||||
WindowDidMiniaturize: 1088,
|
||||
WindowDidMove: 1089,
|
||||
WindowDidOrderOffScreen: 1090,
|
||||
WindowDidOrderOnScreen: 1091,
|
||||
WindowDidResignKey: 1092,
|
||||
WindowDidResignMain: 1093,
|
||||
WindowDidResize: 1094,
|
||||
WindowDidUpdate: 1095,
|
||||
WindowDidUpdateAlpha: 1096,
|
||||
WindowDidUpdateCollectionBehavior: 1097,
|
||||
WindowDidUpdateCollectionProperties: 1098,
|
||||
WindowDidUpdateShadow: 1099,
|
||||
WindowDidUpdateTitle: 1100,
|
||||
WindowDidUpdateToolbar: 1101,
|
||||
WindowShouldClose: 1102,
|
||||
WindowWillBecomeKey: 1103,
|
||||
WindowWillBecomeMain: 1104,
|
||||
WindowWillBeginSheet: 1105,
|
||||
WindowWillChangeOrderingMode: 1106,
|
||||
WindowWillClose: 1107,
|
||||
WindowWillDeminiaturize: 1108,
|
||||
WindowWillEnterFullScreen: 1109,
|
||||
WindowWillEnterVersionBrowser: 1110,
|
||||
WindowWillExitFullScreen: 1111,
|
||||
WindowWillExitVersionBrowser: 1112,
|
||||
WindowWillFocus: 1113,
|
||||
WindowWillMiniaturize: 1114,
|
||||
WindowWillMove: 1115,
|
||||
WindowWillOrderOffScreen: 1116,
|
||||
WindowWillOrderOnScreen: 1117,
|
||||
WindowWillResignMain: 1118,
|
||||
WindowWillResize: 1119,
|
||||
WindowWillUnfocus: 1120,
|
||||
WindowWillUpdate: 1121,
|
||||
WindowWillUpdateAlpha: 1122,
|
||||
WindowWillUpdateCollectionBehavior: 1123,
|
||||
WindowWillUpdateCollectionProperties: 1124,
|
||||
WindowWillUpdateShadow: 1125,
|
||||
WindowWillUpdateTitle: 1126,
|
||||
WindowWillUpdateToolbar: 1127,
|
||||
WindowWillUpdateVisibility: 1128,
|
||||
WindowWillUseStandardFrame: 1129,
|
||||
MenuWillOpen: 1130,
|
||||
MenuDidOpen: 1131,
|
||||
MenuDidClose: 1132,
|
||||
MenuWillSendAction: 1133,
|
||||
MenuDidSendAction: 1134,
|
||||
MenuWillHighlightItem: 1135,
|
||||
MenuDidHighlightItem: 1136,
|
||||
MenuWillDisplayItem: 1137,
|
||||
MenuDidDisplayItem: 1138,
|
||||
MenuWillAddItem: 1139,
|
||||
MenuDidAddItem: 1140,
|
||||
MenuWillRemoveItem: 1141,
|
||||
MenuDidRemoveItem: 1142,
|
||||
MenuWillBeginTracking: 1143,
|
||||
MenuDidBeginTracking: 1144,
|
||||
MenuWillEndTracking: 1145,
|
||||
MenuDidEndTracking: 1146,
|
||||
MenuWillUpdate: 1147,
|
||||
MenuDidUpdate: 1148,
|
||||
MenuWillPopUp: 1149,
|
||||
MenuDidPopUp: 1150,
|
||||
MenuWillSendActionToItem: 1151,
|
||||
MenuDidSendActionToItem: 1152,
|
||||
WebViewDidStartProvisionalNavigation: 1153,
|
||||
WebViewDidReceiveServerRedirectForProvisionalNavigation: 1154,
|
||||
WebViewDidFinishNavigation: 1155,
|
||||
WebViewDidCommitNavigation: 1156,
|
||||
WindowFileDraggingEntered: 1157,
|
||||
WindowFileDraggingPerformed: 1158,
|
||||
WindowFileDraggingExited: 1159,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -366,7 +374,7 @@ type windowsEvents struct {
|
|||
WindowRestore WindowEventType
|
||||
WindowMinimise WindowEventType
|
||||
WindowUnMinimise WindowEventType
|
||||
WindowClose WindowEventType
|
||||
WindowClosing WindowEventType
|
||||
WindowSetFocus WindowEventType
|
||||
WindowKillFocus WindowEventType
|
||||
WindowDragDrop WindowEventType
|
||||
|
|
@ -375,37 +383,69 @@ type windowsEvents struct {
|
|||
WindowDragOver WindowEventType
|
||||
WindowDidMove WindowEventType
|
||||
WindowDidResize WindowEventType
|
||||
WindowShow WindowEventType
|
||||
WindowHide WindowEventType
|
||||
WindowStartMove WindowEventType
|
||||
WindowEndMove WindowEventType
|
||||
WindowStartResize WindowEventType
|
||||
WindowEndResize WindowEventType
|
||||
WindowKeyDown WindowEventType
|
||||
WindowKeyUp WindowEventType
|
||||
WindowZOrderChanged WindowEventType
|
||||
WindowPaint WindowEventType
|
||||
WindowBackgroundErase WindowEventType
|
||||
WindowNonClientHit WindowEventType
|
||||
WindowNonClientMouseDown WindowEventType
|
||||
WindowNonClientMouseUp WindowEventType
|
||||
WindowNonClientMouseMove WindowEventType
|
||||
WindowNonClientMouseLeave WindowEventType
|
||||
}
|
||||
|
||||
func newWindowsEvents() windowsEvents {
|
||||
return windowsEvents{
|
||||
SystemThemeChanged: 1156,
|
||||
APMPowerStatusChange: 1157,
|
||||
APMSuspend: 1158,
|
||||
APMResumeAutomatic: 1159,
|
||||
APMResumeSuspend: 1160,
|
||||
APMPowerSettingChange: 1161,
|
||||
ApplicationStarted: 1162,
|
||||
WebViewNavigationCompleted: 1163,
|
||||
WindowInactive: 1164,
|
||||
WindowActive: 1165,
|
||||
WindowClickActive: 1166,
|
||||
WindowMaximise: 1167,
|
||||
WindowUnMaximise: 1168,
|
||||
WindowFullscreen: 1169,
|
||||
WindowUnFullscreen: 1170,
|
||||
WindowRestore: 1171,
|
||||
WindowMinimise: 1172,
|
||||
WindowUnMinimise: 1173,
|
||||
WindowClose: 1174,
|
||||
WindowSetFocus: 1175,
|
||||
WindowKillFocus: 1176,
|
||||
WindowDragDrop: 1177,
|
||||
WindowDragEnter: 1178,
|
||||
WindowDragLeave: 1179,
|
||||
WindowDragOver: 1180,
|
||||
WindowDidMove: 1181,
|
||||
WindowDidResize: 1182,
|
||||
SystemThemeChanged: 1160,
|
||||
APMPowerStatusChange: 1161,
|
||||
APMSuspend: 1162,
|
||||
APMResumeAutomatic: 1163,
|
||||
APMResumeSuspend: 1164,
|
||||
APMPowerSettingChange: 1165,
|
||||
ApplicationStarted: 1166,
|
||||
WebViewNavigationCompleted: 1167,
|
||||
WindowInactive: 1168,
|
||||
WindowActive: 1169,
|
||||
WindowClickActive: 1170,
|
||||
WindowMaximise: 1171,
|
||||
WindowUnMaximise: 1172,
|
||||
WindowFullscreen: 1173,
|
||||
WindowUnFullscreen: 1174,
|
||||
WindowRestore: 1175,
|
||||
WindowMinimise: 1176,
|
||||
WindowUnMinimise: 1177,
|
||||
WindowClosing: 1178,
|
||||
WindowSetFocus: 1179,
|
||||
WindowKillFocus: 1180,
|
||||
WindowDragDrop: 1181,
|
||||
WindowDragEnter: 1182,
|
||||
WindowDragLeave: 1183,
|
||||
WindowDragOver: 1184,
|
||||
WindowDidMove: 1185,
|
||||
WindowDidResize: 1186,
|
||||
WindowShow: 1187,
|
||||
WindowHide: 1188,
|
||||
WindowStartMove: 1189,
|
||||
WindowEndMove: 1190,
|
||||
WindowStartResize: 1191,
|
||||
WindowEndResize: 1192,
|
||||
WindowKeyDown: 1193,
|
||||
WindowKeyUp: 1194,
|
||||
WindowZOrderChanged: 1195,
|
||||
WindowPaint: 1196,
|
||||
WindowBackgroundErase: 1197,
|
||||
WindowNonClientHit: 1198,
|
||||
WindowNonClientMouseDown: 1199,
|
||||
WindowNonClientMouseUp: 1200,
|
||||
WindowNonClientMouseMove: 1201,
|
||||
WindowNonClientMouseLeave: 1202,
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -464,137 +504,157 @@ var eventToJS = map[uint]string{
|
|||
1071: "mac:WindowDidChangeSpaceOrderingMode",
|
||||
1072: "mac:WindowDidChangeTitle",
|
||||
1073: "mac:WindowDidChangeToolbar",
|
||||
1074: "mac:WindowDidChangeVisibility",
|
||||
1075: "mac:WindowDidDeminiaturize",
|
||||
1076: "mac:WindowDidEndSheet",
|
||||
1077: "mac:WindowDidEnterFullScreen",
|
||||
1078: "mac:WindowDidEnterVersionBrowser",
|
||||
1079: "mac:WindowDidExitFullScreen",
|
||||
1080: "mac:WindowDidExitVersionBrowser",
|
||||
1081: "mac:WindowDidExpose",
|
||||
1082: "mac:WindowDidFocus",
|
||||
1083: "mac:WindowDidMiniaturize",
|
||||
1084: "mac:WindowDidMove",
|
||||
1085: "mac:WindowDidOrderOffScreen",
|
||||
1086: "mac:WindowDidOrderOnScreen",
|
||||
1087: "mac:WindowDidResignKey",
|
||||
1088: "mac:WindowDidResignMain",
|
||||
1089: "mac:WindowDidResize",
|
||||
1090: "mac:WindowDidUpdate",
|
||||
1091: "mac:WindowDidUpdateAlpha",
|
||||
1092: "mac:WindowDidUpdateCollectionBehavior",
|
||||
1093: "mac:WindowDidUpdateCollectionProperties",
|
||||
1094: "mac:WindowDidUpdateShadow",
|
||||
1095: "mac:WindowDidUpdateTitle",
|
||||
1096: "mac:WindowDidUpdateToolbar",
|
||||
1097: "mac:WindowDidUpdateVisibility",
|
||||
1098: "mac:WindowShouldClose!",
|
||||
1099: "mac:WindowWillBecomeKey",
|
||||
1100: "mac:WindowWillBecomeMain",
|
||||
1101: "mac:WindowWillBeginSheet",
|
||||
1102: "mac:WindowWillChangeOrderingMode",
|
||||
1103: "mac:WindowWillClose",
|
||||
1104: "mac:WindowWillDeminiaturize",
|
||||
1105: "mac:WindowWillEnterFullScreen",
|
||||
1106: "mac:WindowWillEnterVersionBrowser",
|
||||
1107: "mac:WindowWillExitFullScreen",
|
||||
1108: "mac:WindowWillExitVersionBrowser",
|
||||
1109: "mac:WindowWillFocus",
|
||||
1110: "mac:WindowWillMiniaturize",
|
||||
1111: "mac:WindowWillMove",
|
||||
1112: "mac:WindowWillOrderOffScreen",
|
||||
1113: "mac:WindowWillOrderOnScreen",
|
||||
1114: "mac:WindowWillResignMain",
|
||||
1115: "mac:WindowWillResize",
|
||||
1116: "mac:WindowWillUnfocus",
|
||||
1117: "mac:WindowWillUpdate",
|
||||
1118: "mac:WindowWillUpdateAlpha",
|
||||
1119: "mac:WindowWillUpdateCollectionBehavior",
|
||||
1120: "mac:WindowWillUpdateCollectionProperties",
|
||||
1121: "mac:WindowWillUpdateShadow",
|
||||
1122: "mac:WindowWillUpdateTitle",
|
||||
1123: "mac:WindowWillUpdateToolbar",
|
||||
1124: "mac:WindowWillUpdateVisibility",
|
||||
1125: "mac:WindowWillUseStandardFrame",
|
||||
1126: "mac:MenuWillOpen",
|
||||
1127: "mac:MenuDidOpen",
|
||||
1128: "mac:MenuDidClose",
|
||||
1129: "mac:MenuWillSendAction",
|
||||
1130: "mac:MenuDidSendAction",
|
||||
1131: "mac:MenuWillHighlightItem",
|
||||
1132: "mac:MenuDidHighlightItem",
|
||||
1133: "mac:MenuWillDisplayItem",
|
||||
1134: "mac:MenuDidDisplayItem",
|
||||
1135: "mac:MenuWillAddItem",
|
||||
1136: "mac:MenuDidAddItem",
|
||||
1137: "mac:MenuWillRemoveItem",
|
||||
1138: "mac:MenuDidRemoveItem",
|
||||
1139: "mac:MenuWillBeginTracking",
|
||||
1140: "mac:MenuDidBeginTracking",
|
||||
1141: "mac:MenuWillEndTracking",
|
||||
1142: "mac:MenuDidEndTracking",
|
||||
1143: "mac:MenuWillUpdate",
|
||||
1144: "mac:MenuDidUpdate",
|
||||
1145: "mac:MenuWillPopUp",
|
||||
1146: "mac:MenuDidPopUp",
|
||||
1147: "mac:MenuWillSendActionToItem",
|
||||
1148: "mac:MenuDidSendActionToItem",
|
||||
1149: "mac:WebViewDidStartProvisionalNavigation",
|
||||
1150: "mac:WebViewDidReceiveServerRedirectForProvisionalNavigation",
|
||||
1151: "mac:WebViewDidFinishNavigation",
|
||||
1152: "mac:WebViewDidCommitNavigation",
|
||||
1153: "mac:WindowFileDraggingEntered",
|
||||
1154: "mac:WindowFileDraggingPerformed",
|
||||
1155: "mac:WindowFileDraggingExited",
|
||||
1156: "windows:SystemThemeChanged",
|
||||
1157: "windows:APMPowerStatusChange",
|
||||
1158: "windows:APMSuspend",
|
||||
1159: "windows:APMResumeAutomatic",
|
||||
1160: "windows:APMResumeSuspend",
|
||||
1161: "windows:APMPowerSettingChange",
|
||||
1162: "windows:ApplicationStarted",
|
||||
1163: "windows:WebViewNavigationCompleted",
|
||||
1164: "windows:WindowInactive",
|
||||
1165: "windows:WindowActive",
|
||||
1166: "windows:WindowClickActive",
|
||||
1167: "windows:WindowMaximise",
|
||||
1168: "windows:WindowUnMaximise",
|
||||
1169: "windows:WindowFullscreen",
|
||||
1170: "windows:WindowUnFullscreen",
|
||||
1171: "windows:WindowRestore",
|
||||
1172: "windows:WindowMinimise",
|
||||
1173: "windows:WindowUnMinimise",
|
||||
1174: "windows:WindowClose",
|
||||
1175: "windows:WindowSetFocus",
|
||||
1176: "windows:WindowKillFocus",
|
||||
1177: "windows:WindowDragDrop",
|
||||
1178: "windows:WindowDragEnter",
|
||||
1179: "windows:WindowDragLeave",
|
||||
1180: "windows:WindowDragOver",
|
||||
1181: "windows:WindowDidMove",
|
||||
1182: "windows:WindowDidResize",
|
||||
1183: "common:ApplicationStarted",
|
||||
1184: "common:WindowMaximise",
|
||||
1185: "common:WindowUnMaximise",
|
||||
1186: "common:WindowFullscreen",
|
||||
1187: "common:WindowUnFullscreen",
|
||||
1188: "common:WindowRestore",
|
||||
1189: "common:WindowMinimise",
|
||||
1190: "common:WindowUnMinimise",
|
||||
1191: "common:WindowClosing",
|
||||
1192: "common:WindowZoom",
|
||||
1193: "common:WindowZoomIn",
|
||||
1194: "common:WindowZoomOut",
|
||||
1195: "common:WindowZoomReset",
|
||||
1196: "common:WindowFocus",
|
||||
1197: "common:WindowLostFocus",
|
||||
1198: "common:WindowShow",
|
||||
1199: "common:WindowHide",
|
||||
1200: "common:WindowDPIChanged",
|
||||
1201: "common:WindowFilesDropped",
|
||||
1202: "common:WindowRuntimeReady",
|
||||
1203: "common:ThemeChanged",
|
||||
1204: "common:WindowDidMove",
|
||||
1205: "common:WindowDidResize",
|
||||
1206: "common:ApplicationOpenedWithFile",
|
||||
1074: "mac:WindowDidDeminiaturize",
|
||||
1075: "mac:WindowDidEndSheet",
|
||||
1076: "mac:WindowDidEnterFullScreen",
|
||||
1077: "mac:WindowMaximise",
|
||||
1078: "mac:WindowUnMaximise",
|
||||
1079: "mac:WindowDidZoom!",
|
||||
1080: "mac:WindowZoomIn!",
|
||||
1081: "mac:WindowZoomOut!",
|
||||
1082: "mac:WindowZoomReset!",
|
||||
1083: "mac:WindowDidEnterVersionBrowser",
|
||||
1084: "mac:WindowDidExitFullScreen",
|
||||
1085: "mac:WindowDidExitVersionBrowser",
|
||||
1086: "mac:WindowDidExpose",
|
||||
1087: "mac:WindowDidFocus",
|
||||
1088: "mac:WindowDidMiniaturize",
|
||||
1089: "mac:WindowDidMove",
|
||||
1090: "mac:WindowDidOrderOffScreen",
|
||||
1091: "mac:WindowDidOrderOnScreen",
|
||||
1092: "mac:WindowDidResignKey",
|
||||
1093: "mac:WindowDidResignMain",
|
||||
1094: "mac:WindowDidResize",
|
||||
1095: "mac:WindowDidUpdate",
|
||||
1096: "mac:WindowDidUpdateAlpha",
|
||||
1097: "mac:WindowDidUpdateCollectionBehavior",
|
||||
1098: "mac:WindowDidUpdateCollectionProperties",
|
||||
1099: "mac:WindowDidUpdateShadow",
|
||||
1100: "mac:WindowDidUpdateTitle",
|
||||
1101: "mac:WindowDidUpdateToolbar",
|
||||
1102: "mac:WindowShouldClose!",
|
||||
1103: "mac:WindowWillBecomeKey",
|
||||
1104: "mac:WindowWillBecomeMain",
|
||||
1105: "mac:WindowWillBeginSheet",
|
||||
1106: "mac:WindowWillChangeOrderingMode",
|
||||
1107: "mac:WindowWillClose",
|
||||
1108: "mac:WindowWillDeminiaturize",
|
||||
1109: "mac:WindowWillEnterFullScreen",
|
||||
1110: "mac:WindowWillEnterVersionBrowser",
|
||||
1111: "mac:WindowWillExitFullScreen",
|
||||
1112: "mac:WindowWillExitVersionBrowser",
|
||||
1113: "mac:WindowWillFocus",
|
||||
1114: "mac:WindowWillMiniaturize",
|
||||
1115: "mac:WindowWillMove",
|
||||
1116: "mac:WindowWillOrderOffScreen",
|
||||
1117: "mac:WindowWillOrderOnScreen",
|
||||
1118: "mac:WindowWillResignMain",
|
||||
1119: "mac:WindowWillResize",
|
||||
1120: "mac:WindowWillUnfocus",
|
||||
1121: "mac:WindowWillUpdate",
|
||||
1122: "mac:WindowWillUpdateAlpha",
|
||||
1123: "mac:WindowWillUpdateCollectionBehavior",
|
||||
1124: "mac:WindowWillUpdateCollectionProperties",
|
||||
1125: "mac:WindowWillUpdateShadow",
|
||||
1126: "mac:WindowWillUpdateTitle",
|
||||
1127: "mac:WindowWillUpdateToolbar",
|
||||
1128: "mac:WindowWillUpdateVisibility",
|
||||
1129: "mac:WindowWillUseStandardFrame",
|
||||
1130: "mac:MenuWillOpen",
|
||||
1131: "mac:MenuDidOpen",
|
||||
1132: "mac:MenuDidClose",
|
||||
1133: "mac:MenuWillSendAction",
|
||||
1134: "mac:MenuDidSendAction",
|
||||
1135: "mac:MenuWillHighlightItem",
|
||||
1136: "mac:MenuDidHighlightItem",
|
||||
1137: "mac:MenuWillDisplayItem",
|
||||
1138: "mac:MenuDidDisplayItem",
|
||||
1139: "mac:MenuWillAddItem",
|
||||
1140: "mac:MenuDidAddItem",
|
||||
1141: "mac:MenuWillRemoveItem",
|
||||
1142: "mac:MenuDidRemoveItem",
|
||||
1143: "mac:MenuWillBeginTracking",
|
||||
1144: "mac:MenuDidBeginTracking",
|
||||
1145: "mac:MenuWillEndTracking",
|
||||
1146: "mac:MenuDidEndTracking",
|
||||
1147: "mac:MenuWillUpdate",
|
||||
1148: "mac:MenuDidUpdate",
|
||||
1149: "mac:MenuWillPopUp",
|
||||
1150: "mac:MenuDidPopUp",
|
||||
1151: "mac:MenuWillSendActionToItem",
|
||||
1152: "mac:MenuDidSendActionToItem",
|
||||
1153: "mac:WebViewDidStartProvisionalNavigation",
|
||||
1154: "mac:WebViewDidReceiveServerRedirectForProvisionalNavigation",
|
||||
1155: "mac:WebViewDidFinishNavigation",
|
||||
1156: "mac:WebViewDidCommitNavigation",
|
||||
1157: "mac:WindowFileDraggingEntered",
|
||||
1158: "mac:WindowFileDraggingPerformed",
|
||||
1159: "mac:WindowFileDraggingExited",
|
||||
1160: "windows:SystemThemeChanged",
|
||||
1161: "windows:APMPowerStatusChange",
|
||||
1162: "windows:APMSuspend",
|
||||
1163: "windows:APMResumeAutomatic",
|
||||
1164: "windows:APMResumeSuspend",
|
||||
1165: "windows:APMPowerSettingChange",
|
||||
1166: "windows:ApplicationStarted",
|
||||
1167: "windows:WebViewNavigationCompleted",
|
||||
1168: "windows:WindowInactive",
|
||||
1169: "windows:WindowActive",
|
||||
1170: "windows:WindowClickActive",
|
||||
1171: "windows:WindowMaximise",
|
||||
1172: "windows:WindowUnMaximise",
|
||||
1173: "windows:WindowFullscreen",
|
||||
1174: "windows:WindowUnFullscreen",
|
||||
1175: "windows:WindowRestore",
|
||||
1176: "windows:WindowMinimise",
|
||||
1177: "windows:WindowUnMinimise",
|
||||
1178: "windows:WindowClosing",
|
||||
1179: "windows:WindowSetFocus",
|
||||
1180: "windows:WindowKillFocus",
|
||||
1181: "windows:WindowDragDrop",
|
||||
1182: "windows:WindowDragEnter",
|
||||
1183: "windows:WindowDragLeave",
|
||||
1184: "windows:WindowDragOver",
|
||||
1185: "windows:WindowDidMove",
|
||||
1186: "windows:WindowDidResize",
|
||||
1187: "windows:WindowShow",
|
||||
1188: "windows:WindowHide",
|
||||
1189: "windows:WindowStartMove",
|
||||
1190: "windows:WindowEndMove",
|
||||
1191: "windows:WindowStartResize",
|
||||
1192: "windows:WindowEndResize",
|
||||
1193: "windows:WindowKeyDown",
|
||||
1194: "windows:WindowKeyUp",
|
||||
1195: "windows:WindowZOrderChanged",
|
||||
1196: "windows:WindowPaint",
|
||||
1197: "windows:WindowBackgroundErase",
|
||||
1198: "windows:WindowNonClientHit",
|
||||
1199: "windows:WindowNonClientMouseDown",
|
||||
1200: "windows:WindowNonClientMouseUp",
|
||||
1201: "windows:WindowNonClientMouseMove",
|
||||
1202: "windows:WindowNonClientMouseLeave",
|
||||
1203: "common:ApplicationStarted",
|
||||
1204: "common:WindowMaximise",
|
||||
1205: "common:WindowUnMaximise",
|
||||
1206: "common:WindowFullscreen",
|
||||
1207: "common:WindowUnFullscreen",
|
||||
1208: "common:WindowRestore",
|
||||
1209: "common:WindowMinimise",
|
||||
1210: "common:WindowUnMinimise",
|
||||
1211: "common:WindowClosing",
|
||||
1212: "common:WindowZoom",
|
||||
1213: "common:WindowZoomIn",
|
||||
1214: "common:WindowZoomOut",
|
||||
1215: "common:WindowZoomReset",
|
||||
1216: "common:WindowFocus",
|
||||
1217: "common:WindowLostFocus",
|
||||
1218: "common:WindowShow",
|
||||
1219: "common:WindowHide",
|
||||
1220: "common:WindowDPIChanged",
|
||||
1221: "common:WindowFilesDropped",
|
||||
1222: "common:WindowRuntimeReady",
|
||||
1223: "common:ThemeChanged",
|
||||
1224: "common:WindowDidMove",
|
||||
1225: "common:WindowDidResize",
|
||||
1226: "common:ApplicationOpenedWithFile",
|
||||
}
|
||||
|
|
|
|||
|
|
@ -48,10 +48,15 @@ mac:WindowDidChangeSpace
|
|||
mac:WindowDidChangeSpaceOrderingMode
|
||||
mac:WindowDidChangeTitle
|
||||
mac:WindowDidChangeToolbar
|
||||
mac:WindowDidChangeVisibility
|
||||
mac:WindowDidDeminiaturize
|
||||
mac:WindowDidEndSheet
|
||||
mac:WindowDidEnterFullScreen
|
||||
mac:WindowMaximise
|
||||
mac:WindowUnMaximise
|
||||
mac:WindowDidZoom!
|
||||
mac:WindowZoomIn!
|
||||
mac:WindowZoomOut!
|
||||
mac:WindowZoomReset!
|
||||
mac:WindowDidEnterVersionBrowser
|
||||
mac:WindowDidExitFullScreen
|
||||
mac:WindowDidExitVersionBrowser
|
||||
|
|
@ -71,7 +76,6 @@ mac:WindowDidUpdateCollectionProperties
|
|||
mac:WindowDidUpdateShadow
|
||||
mac:WindowDidUpdateTitle
|
||||
mac:WindowDidUpdateToolbar
|
||||
mac:WindowDidUpdateVisibility
|
||||
mac:WindowShouldClose!
|
||||
mac:WindowWillBecomeKey
|
||||
mac:WindowWillBecomeMain
|
||||
|
|
@ -148,7 +152,7 @@ windows:WindowUnFullscreen
|
|||
windows:WindowRestore
|
||||
windows:WindowMinimise
|
||||
windows:WindowUnMinimise
|
||||
windows:WindowClose
|
||||
windows:WindowClosing
|
||||
windows:WindowSetFocus
|
||||
windows:WindowKillFocus
|
||||
windows:WindowDragDrop
|
||||
|
|
@ -157,6 +161,22 @@ windows:WindowDragLeave
|
|||
windows:WindowDragOver
|
||||
windows:WindowDidMove
|
||||
windows:WindowDidResize
|
||||
windows:WindowShow
|
||||
windows:WindowHide
|
||||
windows:WindowStartMove
|
||||
windows:WindowEndMove
|
||||
windows:WindowStartResize
|
||||
windows:WindowEndResize
|
||||
windows:WindowKeyDown
|
||||
windows:WindowKeyUp
|
||||
windows:WindowZOrderChanged
|
||||
windows:WindowPaint
|
||||
windows:WindowBackgroundErase
|
||||
windows:WindowNonClientHit
|
||||
windows:WindowNonClientMouseDown
|
||||
windows:WindowNonClientMouseUp
|
||||
windows:WindowNonClientMouseMove
|
||||
windows:WindowNonClientMouseLeave
|
||||
common:ApplicationStarted
|
||||
common:WindowMaximise
|
||||
common:WindowUnMaximise
|
||||
|
|
|
|||
|
|
@ -48,90 +48,94 @@ extern void processWindowEvent(unsigned int, unsigned int);
|
|||
#define EventWindowDidChangeSpaceOrderingMode 1071
|
||||
#define EventWindowDidChangeTitle 1072
|
||||
#define EventWindowDidChangeToolbar 1073
|
||||
#define EventWindowDidChangeVisibility 1074
|
||||
#define EventWindowDidDeminiaturize 1075
|
||||
#define EventWindowDidEndSheet 1076
|
||||
#define EventWindowDidEnterFullScreen 1077
|
||||
#define EventWindowDidEnterVersionBrowser 1078
|
||||
#define EventWindowDidExitFullScreen 1079
|
||||
#define EventWindowDidExitVersionBrowser 1080
|
||||
#define EventWindowDidExpose 1081
|
||||
#define EventWindowDidFocus 1082
|
||||
#define EventWindowDidMiniaturize 1083
|
||||
#define EventWindowDidMove 1084
|
||||
#define EventWindowDidOrderOffScreen 1085
|
||||
#define EventWindowDidOrderOnScreen 1086
|
||||
#define EventWindowDidResignKey 1087
|
||||
#define EventWindowDidResignMain 1088
|
||||
#define EventWindowDidResize 1089
|
||||
#define EventWindowDidUpdate 1090
|
||||
#define EventWindowDidUpdateAlpha 1091
|
||||
#define EventWindowDidUpdateCollectionBehavior 1092
|
||||
#define EventWindowDidUpdateCollectionProperties 1093
|
||||
#define EventWindowDidUpdateShadow 1094
|
||||
#define EventWindowDidUpdateTitle 1095
|
||||
#define EventWindowDidUpdateToolbar 1096
|
||||
#define EventWindowDidUpdateVisibility 1097
|
||||
#define EventWindowShouldClose 1098
|
||||
#define EventWindowWillBecomeKey 1099
|
||||
#define EventWindowWillBecomeMain 1100
|
||||
#define EventWindowWillBeginSheet 1101
|
||||
#define EventWindowWillChangeOrderingMode 1102
|
||||
#define EventWindowWillClose 1103
|
||||
#define EventWindowWillDeminiaturize 1104
|
||||
#define EventWindowWillEnterFullScreen 1105
|
||||
#define EventWindowWillEnterVersionBrowser 1106
|
||||
#define EventWindowWillExitFullScreen 1107
|
||||
#define EventWindowWillExitVersionBrowser 1108
|
||||
#define EventWindowWillFocus 1109
|
||||
#define EventWindowWillMiniaturize 1110
|
||||
#define EventWindowWillMove 1111
|
||||
#define EventWindowWillOrderOffScreen 1112
|
||||
#define EventWindowWillOrderOnScreen 1113
|
||||
#define EventWindowWillResignMain 1114
|
||||
#define EventWindowWillResize 1115
|
||||
#define EventWindowWillUnfocus 1116
|
||||
#define EventWindowWillUpdate 1117
|
||||
#define EventWindowWillUpdateAlpha 1118
|
||||
#define EventWindowWillUpdateCollectionBehavior 1119
|
||||
#define EventWindowWillUpdateCollectionProperties 1120
|
||||
#define EventWindowWillUpdateShadow 1121
|
||||
#define EventWindowWillUpdateTitle 1122
|
||||
#define EventWindowWillUpdateToolbar 1123
|
||||
#define EventWindowWillUpdateVisibility 1124
|
||||
#define EventWindowWillUseStandardFrame 1125
|
||||
#define EventMenuWillOpen 1126
|
||||
#define EventMenuDidOpen 1127
|
||||
#define EventMenuDidClose 1128
|
||||
#define EventMenuWillSendAction 1129
|
||||
#define EventMenuDidSendAction 1130
|
||||
#define EventMenuWillHighlightItem 1131
|
||||
#define EventMenuDidHighlightItem 1132
|
||||
#define EventMenuWillDisplayItem 1133
|
||||
#define EventMenuDidDisplayItem 1134
|
||||
#define EventMenuWillAddItem 1135
|
||||
#define EventMenuDidAddItem 1136
|
||||
#define EventMenuWillRemoveItem 1137
|
||||
#define EventMenuDidRemoveItem 1138
|
||||
#define EventMenuWillBeginTracking 1139
|
||||
#define EventMenuDidBeginTracking 1140
|
||||
#define EventMenuWillEndTracking 1141
|
||||
#define EventMenuDidEndTracking 1142
|
||||
#define EventMenuWillUpdate 1143
|
||||
#define EventMenuDidUpdate 1144
|
||||
#define EventMenuWillPopUp 1145
|
||||
#define EventMenuDidPopUp 1146
|
||||
#define EventMenuWillSendActionToItem 1147
|
||||
#define EventMenuDidSendActionToItem 1148
|
||||
#define EventWebViewDidStartProvisionalNavigation 1149
|
||||
#define EventWebViewDidReceiveServerRedirectForProvisionalNavigation 1150
|
||||
#define EventWebViewDidFinishNavigation 1151
|
||||
#define EventWebViewDidCommitNavigation 1152
|
||||
#define EventWindowFileDraggingEntered 1153
|
||||
#define EventWindowFileDraggingPerformed 1154
|
||||
#define EventWindowFileDraggingExited 1155
|
||||
#define EventWindowDidDeminiaturize 1074
|
||||
#define EventWindowDidEndSheet 1075
|
||||
#define EventWindowDidEnterFullScreen 1076
|
||||
#define EventWindowMaximise 1077
|
||||
#define EventWindowUnMaximise 1078
|
||||
#define EventWindowDidZoom 1079
|
||||
#define EventWindowZoomIn 1080
|
||||
#define EventWindowZoomOut 1081
|
||||
#define EventWindowZoomReset 1082
|
||||
#define EventWindowDidEnterVersionBrowser 1083
|
||||
#define EventWindowDidExitFullScreen 1084
|
||||
#define EventWindowDidExitVersionBrowser 1085
|
||||
#define EventWindowDidExpose 1086
|
||||
#define EventWindowDidFocus 1087
|
||||
#define EventWindowDidMiniaturize 1088
|
||||
#define EventWindowDidMove 1089
|
||||
#define EventWindowDidOrderOffScreen 1090
|
||||
#define EventWindowDidOrderOnScreen 1091
|
||||
#define EventWindowDidResignKey 1092
|
||||
#define EventWindowDidResignMain 1093
|
||||
#define EventWindowDidResize 1094
|
||||
#define EventWindowDidUpdate 1095
|
||||
#define EventWindowDidUpdateAlpha 1096
|
||||
#define EventWindowDidUpdateCollectionBehavior 1097
|
||||
#define EventWindowDidUpdateCollectionProperties 1098
|
||||
#define EventWindowDidUpdateShadow 1099
|
||||
#define EventWindowDidUpdateTitle 1100
|
||||
#define EventWindowDidUpdateToolbar 1101
|
||||
#define EventWindowShouldClose 1102
|
||||
#define EventWindowWillBecomeKey 1103
|
||||
#define EventWindowWillBecomeMain 1104
|
||||
#define EventWindowWillBeginSheet 1105
|
||||
#define EventWindowWillChangeOrderingMode 1106
|
||||
#define EventWindowWillClose 1107
|
||||
#define EventWindowWillDeminiaturize 1108
|
||||
#define EventWindowWillEnterFullScreen 1109
|
||||
#define EventWindowWillEnterVersionBrowser 1110
|
||||
#define EventWindowWillExitFullScreen 1111
|
||||
#define EventWindowWillExitVersionBrowser 1112
|
||||
#define EventWindowWillFocus 1113
|
||||
#define EventWindowWillMiniaturize 1114
|
||||
#define EventWindowWillMove 1115
|
||||
#define EventWindowWillOrderOffScreen 1116
|
||||
#define EventWindowWillOrderOnScreen 1117
|
||||
#define EventWindowWillResignMain 1118
|
||||
#define EventWindowWillResize 1119
|
||||
#define EventWindowWillUnfocus 1120
|
||||
#define EventWindowWillUpdate 1121
|
||||
#define EventWindowWillUpdateAlpha 1122
|
||||
#define EventWindowWillUpdateCollectionBehavior 1123
|
||||
#define EventWindowWillUpdateCollectionProperties 1124
|
||||
#define EventWindowWillUpdateShadow 1125
|
||||
#define EventWindowWillUpdateTitle 1126
|
||||
#define EventWindowWillUpdateToolbar 1127
|
||||
#define EventWindowWillUpdateVisibility 1128
|
||||
#define EventWindowWillUseStandardFrame 1129
|
||||
#define EventMenuWillOpen 1130
|
||||
#define EventMenuDidOpen 1131
|
||||
#define EventMenuDidClose 1132
|
||||
#define EventMenuWillSendAction 1133
|
||||
#define EventMenuDidSendAction 1134
|
||||
#define EventMenuWillHighlightItem 1135
|
||||
#define EventMenuDidHighlightItem 1136
|
||||
#define EventMenuWillDisplayItem 1137
|
||||
#define EventMenuDidDisplayItem 1138
|
||||
#define EventMenuWillAddItem 1139
|
||||
#define EventMenuDidAddItem 1140
|
||||
#define EventMenuWillRemoveItem 1141
|
||||
#define EventMenuDidRemoveItem 1142
|
||||
#define EventMenuWillBeginTracking 1143
|
||||
#define EventMenuDidBeginTracking 1144
|
||||
#define EventMenuWillEndTracking 1145
|
||||
#define EventMenuDidEndTracking 1146
|
||||
#define EventMenuWillUpdate 1147
|
||||
#define EventMenuDidUpdate 1148
|
||||
#define EventMenuWillPopUp 1149
|
||||
#define EventMenuDidPopUp 1150
|
||||
#define EventMenuWillSendActionToItem 1151
|
||||
#define EventMenuDidSendActionToItem 1152
|
||||
#define EventWebViewDidStartProvisionalNavigation 1153
|
||||
#define EventWebViewDidReceiveServerRedirectForProvisionalNavigation 1154
|
||||
#define EventWebViewDidFinishNavigation 1155
|
||||
#define EventWebViewDidCommitNavigation 1156
|
||||
#define EventWindowFileDraggingEntered 1157
|
||||
#define EventWindowFileDraggingPerformed 1158
|
||||
#define EventWindowFileDraggingExited 1159
|
||||
|
||||
#define MAX_EVENTS 1156
|
||||
#define MAX_EVENTS 1160
|
||||
|
||||
|
||||
#endif
|
||||
|
|
@ -3661,3 +3661,19 @@ const ULW_COLORKEY = 1
|
|||
const ULW_ALPHA = 2
|
||||
const ULW_OPAQUE = 4
|
||||
const ULW_EX_NORESIZE = 8
|
||||
|
||||
// RedrawWindow flags
|
||||
const (
|
||||
RDW_INVALIDATE = 0x0001
|
||||
RDW_INTERNALPAINT = 0x0002
|
||||
RDW_ERASE = 0x0004
|
||||
RDW_VALIDATE = 0x0008
|
||||
RDW_NOINTERNALPAINT = 0x0010
|
||||
RDW_NOERASE = 0x0020
|
||||
RDW_NOCHILDREN = 0x0040
|
||||
RDW_ALLCHILDREN = 0x0080
|
||||
RDW_UPDATENOW = 0x0100
|
||||
RDW_ERASENOW = 0x0200
|
||||
RDW_FRAME = 0x0400
|
||||
RDW_NOFRAME = 0x0800
|
||||
)
|
||||
|
|
|
|||
|
|
@ -5,13 +5,13 @@ package w32
|
|||
type Menu HMENU
|
||||
type PopupMenu Menu
|
||||
|
||||
func (m Menu) Destroy() bool {
|
||||
func (m Menu) destroy() bool {
|
||||
ret, _, _ := procDestroyMenu.Call(uintptr(m))
|
||||
return ret != 0
|
||||
}
|
||||
|
||||
func (p PopupMenu) Destroy() bool {
|
||||
return Menu(p).Destroy()
|
||||
func (p PopupMenu) destroy() bool {
|
||||
return Menu(p).destroy()
|
||||
}
|
||||
|
||||
func (p PopupMenu) Track(hwnd HWND, flags uint32, x, y int32) bool {
|
||||
|
|
|
|||
|
|
@ -176,6 +176,8 @@ var (
|
|||
|
||||
procSetMenuItemBitmaps = moduser32.NewProc("SetMenuItemBitmaps")
|
||||
|
||||
procRedrawWindow = moduser32.NewProc("RedrawWindow")
|
||||
|
||||
mainThread HANDLE
|
||||
)
|
||||
|
||||
|
|
@ -1413,3 +1415,12 @@ func GetScrollInfo(hwnd HWND, fnBar int32, lpsi *SCROLLINFO) bool {
|
|||
|
||||
return ret != 0
|
||||
}
|
||||
|
||||
func RedrawWindow(hwnd HWND, lprcUpdate *RECT, hrgnUpdate HRGN, flags uint32) bool {
|
||||
ret, _, _ := procRedrawWindow.Call(
|
||||
uintptr(hwnd),
|
||||
uintptr(unsafe.Pointer(lprcUpdate)),
|
||||
uintptr(hrgnUpdate),
|
||||
uintptr(flags))
|
||||
return ret != 0
|
||||
}
|
||||
|
|
|
|||
|
|
@ -34,6 +34,15 @@ const (
|
|||
GCLP_HICON int32 = -14
|
||||
)
|
||||
|
||||
type WINDOWPOS struct {
|
||||
HwndInsertAfter HWND
|
||||
X int32
|
||||
Y int32
|
||||
Cx int32
|
||||
Cy int32
|
||||
Flags uint32
|
||||
}
|
||||
|
||||
func ExtendFrameIntoClientArea(hwnd uintptr, extend bool) error {
|
||||
// -1: Adds the default frame styling (aero shadow and e.g. rounded corners on Windows 11)
|
||||
// Also shows the caption buttons if transparent ant translucent but they don't work.
|
||||
|
|
|
|||
11
v3/tasks/events/go.sum
Normal file
11
v3/tasks/events/go.sum
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
github.com/Masterminds/semver/v3 v3.3.0 h1:B8LGeaivUe71a5qox1ICM/JLl0NqZSW5CHyL+hmvYS0=
|
||||
github.com/Masterminds/semver/v3 v3.3.0/go.mod h1:4V+yj/TJE1HU9XfppCwVMZq3I84lprf4nC11bSS5beM=
|
||||
github.com/tidwall/gjson v1.14.2/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/gjson v1.18.0 h1:FIDeeyB800efLX89e5a8Y0BNH+LOngJyGrIWxG2FKQY=
|
||||
github.com/tidwall/gjson v1.18.0/go.mod h1:/wbyibRr2FHMks5tjHJ5F8dMZh3AcwJEMf5vlfC0lxk=
|
||||
github.com/tidwall/match v1.1.1 h1:+Ho715JplO36QYgwN9PGYNhgZvoUSc9X2c80KVTi+GA=
|
||||
github.com/tidwall/match v1.1.1/go.mod h1:eRSPERbgtNPcGhD8UCthc6PmLEQXEWd3PRB5JTxsfmM=
|
||||
github.com/tidwall/pretty v1.2.0 h1:RWIZEg2iJ8/g6fDDYzMpobmaoGh5OLl4AXtGUGPcqCs=
|
||||
github.com/tidwall/pretty v1.2.0/go.mod h1:ITEVvHYasfjBbM0u2Pg8T2nJnzm8xPwvNhhsoaGGjNU=
|
||||
github.com/tidwall/sjson v1.2.5 h1:kLy8mja+1c9jlljvWTlSazM7cKDRfJuR/bOJhcY5NcY=
|
||||
github.com/tidwall/sjson v1.2.5/go.mod h1:Fvgq9kS/6ociJEDnK0Fk1cpYF4FIW6ZF7LAe+6jwd28=
|
||||
Loading…
Add table
Add a link
Reference in a new issue