mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-16 08:59:29 +08:00
Fix context menu issues.
Fix WindowID for requests on windows. Add `Windows.ApplicationStarted` event
This commit is contained in:
parent
740b2b0979
commit
3d88bf8795
@ -17,22 +17,22 @@ The main goal is to get most of the examples working on all platforms.
|
||||
- P - Partially working
|
||||
- N - Not working
|
||||
|
||||
| Example | Mac | Windows | Linux |
|
||||
|--------------|-----|---------|-------|
|
||||
| binding | | W | |
|
||||
| build | | W | |
|
||||
| clipboard | | W | |
|
||||
| contextmenus | | N | |
|
||||
| dialog | | W | |
|
||||
| events | | N | |
|
||||
| frameless | | W | |
|
||||
| keybindings | | W | |
|
||||
| menu | | W | |
|
||||
| plain | | W | |
|
||||
| screen | | W | |
|
||||
| systray | | W | |
|
||||
| window | | W | |
|
||||
| wml | | W | |
|
||||
| Example | Mac | Windows | Linux |
|
||||
|---------------|-----|---------|-------|
|
||||
| binding | | W | |
|
||||
| build | | W | |
|
||||
| clipboard | | W | |
|
||||
| context menus | | W | |
|
||||
| dialog | | W | |
|
||||
| events | | W | |
|
||||
| frameless | | W | |
|
||||
| keybindings | | W | |
|
||||
| menu | | W | |
|
||||
| plain | | W | |
|
||||
| screen | | W | |
|
||||
| systray | | W | |
|
||||
| window | | W | |
|
||||
| wml | | W | |
|
||||
|
||||
|
||||
### Alpha 2
|
||||
|
@ -35,7 +35,7 @@ require (
|
||||
github.com/samber/lo v1.38.1 // indirect
|
||||
github.com/sergi/go-diff v1.2.0 // indirect
|
||||
github.com/stretchr/testify v1.8.4 // indirect
|
||||
github.com/wailsapp/go-webview2 v1.0.7 // indirect
|
||||
github.com/wailsapp/go-webview2 v1.0.8-0.20231010092311-42cbb98eb53b // indirect
|
||||
github.com/wailsapp/mimetype v1.4.1 // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.0 // indirect
|
||||
golang.org/x/crypto v0.9.0 // indirect
|
||||
|
@ -105,6 +105,7 @@ github.com/tmclane/purego v0.0.0-20230601213035-1f25e70d7b01 h1:oQwu3iNDywGp1Hry
|
||||
github.com/tmclane/purego v0.0.0-20230601213035-1f25e70d7b01/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ=
|
||||
github.com/wailsapp/go-webview2 v1.0.7 h1:s95+7irJsAsTy1RsjJ6N0cYX7tZ4gP7Uzawds0L2urs=
|
||||
github.com/wailsapp/go-webview2 v1.0.7/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
|
||||
github.com/wailsapp/go-webview2 v1.0.8-0.20231010092311-42cbb98eb53b/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
|
||||
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
|
||||
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
|
||||
github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI=
|
||||
|
@ -1,14 +1,32 @@
|
||||
# contextmenus
|
||||
|
||||
This example shows how to create a context menu for your application.
|
||||
It demonstrates window level and global context menus.
|
||||
|
||||
A simple menu is registered with the window and the application with the id "test".
|
||||
In our frontend html, we then use the `--custom-contextmenu` style to attach the menu to an element.
|
||||
We also use the `--custom-contextmenu-data` style to pass data to the menu callback which can be read in Go.
|
||||
This is really useful when using components to distinguish between different elements.
|
||||
|
||||
```go
|
||||
|
||||
```html
|
||||
|
||||
<div class="region" id="123abc" style="--custom-contextmenu: test; --custom-contextmenu-data: 1">
|
||||
<h1>1</h1>
|
||||
</div>
|
||||
<div class="region" id="234abc" style="--custom-contextmenu: test; --custom-contextmenu-data: 2">
|
||||
<h1>2</h1>
|
||||
</div>
|
||||
```
|
||||
|
||||
# Status
|
||||
|
||||
| Platform | Status |
|
||||
|----------|-------------|
|
||||
| Mac | |
|
||||
| Windows | Not Working |
|
||||
| Linux | |
|
||||
| Platform | Status |
|
||||
|----------|---------|
|
||||
| Mac | |
|
||||
| Windows | Working |
|
||||
| Linux | |
|
||||
|
||||
# TODO
|
||||
|
||||
|
@ -3,7 +3,6 @@ package main
|
||||
import (
|
||||
"embed"
|
||||
_ "embed"
|
||||
"fmt"
|
||||
"log"
|
||||
|
||||
"github.com/wailsapp/wails/v3/pkg/application"
|
||||
@ -38,12 +37,12 @@ func main() {
|
||||
|
||||
contextMenu := app.NewMenu()
|
||||
contextMenu.Add("Click Me").OnClick(func(data *application.Context) {
|
||||
fmt.Printf("Context menu data: %+v\n", data.ContextMenuData())
|
||||
app.Logger.Info("Context menu", "context data", data.ContextMenuData())
|
||||
})
|
||||
|
||||
globalContextMenu := app.NewMenu()
|
||||
globalContextMenu.Add("Default context menu item").OnClick(func(data *application.Context) {
|
||||
fmt.Printf("Context menu data: %+v\n", data.ContextMenuData())
|
||||
app.Logger.Info("Context menu", "context data", data.ContextMenuData())
|
||||
})
|
||||
|
||||
// Registering the menu with a window will make it available to that window only
|
||||
|
@ -33,7 +33,7 @@ require (
|
||||
github.com/samber/lo v1.38.1 // indirect
|
||||
github.com/sergi/go-diff v1.2.0 // indirect
|
||||
github.com/stretchr/testify v1.8.4 // indirect
|
||||
github.com/wailsapp/go-webview2 v1.0.7 // indirect
|
||||
github.com/wailsapp/go-webview2 v1.0.8-0.20231010092311-42cbb98eb53b // indirect
|
||||
github.com/wailsapp/mimetype v1.4.1 // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.0 // indirect
|
||||
golang.org/x/crypto v0.9.0 // indirect
|
||||
|
@ -105,6 +105,7 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/wailsapp/go-webview2 v1.0.7 h1:s95+7irJsAsTy1RsjJ6N0cYX7tZ4gP7Uzawds0L2urs=
|
||||
github.com/wailsapp/go-webview2 v1.0.7/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
|
||||
github.com/wailsapp/go-webview2 v1.0.8-0.20231010092311-42cbb98eb53b/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
|
||||
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
|
||||
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
|
||||
github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI=
|
||||
|
@ -1,3 +1,25 @@
|
||||
# Events Example
|
||||
|
||||
This example is not ready for testing yet.
|
||||
This example is a demonstration of using the new events API.
|
||||
It has 2 windows that can emit events from the frontend and the backend emits an event every 10 seconds.
|
||||
All events emitted are logged either to the console or the window.
|
||||
|
||||
It also demonstrates the use of `RegisterHook` to register a function to be called when an event is emitted.
|
||||
For one window, it captures the `WindowClosing` event and prevents the window from closing twice.
|
||||
The other window uses both hooks and events to show the window is gaining focus.
|
||||
|
||||
## Running the example
|
||||
|
||||
To run the example, simply run the following command:
|
||||
|
||||
```bash
|
||||
go run main.go
|
||||
```
|
||||
|
||||
# Status
|
||||
|
||||
| Platform | Status |
|
||||
|----------|---------|
|
||||
| Mac | |
|
||||
| Windows | Working |
|
||||
| Linux | |
|
@ -28,13 +28,12 @@ func main() {
|
||||
|
||||
// Custom event handling
|
||||
app.Events.On("myevent", func(e *application.WailsEvent) {
|
||||
app.Logger.Info("[Go] WailsEvent received: %+v\n", e)
|
||||
app.Logger.Info("[Go] WailsEvent received", "name", e.Name, "data", e.Data, "sender", e.Sender, "cancelled", e.Cancelled)
|
||||
})
|
||||
|
||||
// OS specific application events
|
||||
app.On(events.Common.ApplicationStarted, func(event *application.Event) {
|
||||
for {
|
||||
app.Logger.Info("Sending event from Go!")
|
||||
app.Events.Emit(&application.WailsEvent{
|
||||
Name: "myevent",
|
||||
Data: "hello",
|
||||
|
@ -32,7 +32,7 @@ require (
|
||||
github.com/rivo/uniseg v0.4.4 // indirect
|
||||
github.com/samber/lo v1.38.1 // indirect
|
||||
github.com/sergi/go-diff v1.2.0 // indirect
|
||||
github.com/wailsapp/go-webview2 v1.0.7 // indirect
|
||||
github.com/wailsapp/go-webview2 v1.0.8-0.20231010092311-42cbb98eb53b // indirect
|
||||
github.com/wailsapp/mimetype v1.4.1 // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.0 // indirect
|
||||
golang.org/x/crypto v0.9.0 // indirect
|
||||
|
@ -99,6 +99,7 @@ github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJy
|
||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
||||
github.com/wailsapp/go-webview2 v1.0.7 h1:s95+7irJsAsTy1RsjJ6N0cYX7tZ4gP7Uzawds0L2urs=
|
||||
github.com/wailsapp/go-webview2 v1.0.7/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
|
||||
github.com/wailsapp/go-webview2 v1.0.8-0.20231010092311-42cbb98eb53b/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
|
||||
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
|
||||
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
|
||||
github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI=
|
||||
|
@ -40,7 +40,7 @@ require (
|
||||
github.com/samber/lo v1.38.1 // indirect
|
||||
github.com/sergi/go-diff v1.2.0 // indirect
|
||||
github.com/stretchr/testify v1.8.4 // indirect
|
||||
github.com/wailsapp/go-webview2 v1.0.7 // indirect
|
||||
github.com/wailsapp/go-webview2 v1.0.8-0.20231010092311-42cbb98eb53b // indirect
|
||||
github.com/wailsapp/mimetype v1.4.1 // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.0 // indirect
|
||||
golang.org/x/crypto v0.9.0 // indirect
|
||||
|
@ -118,6 +118,7 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/wailsapp/go-webview2 v1.0.7 h1:s95+7irJsAsTy1RsjJ6N0cYX7tZ4gP7Uzawds0L2urs=
|
||||
github.com/wailsapp/go-webview2 v1.0.7/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
|
||||
github.com/wailsapp/go-webview2 v1.0.8-0.20231010092311-42cbb98eb53b/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
|
||||
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
|
||||
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
|
||||
github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI=
|
||||
|
@ -35,7 +35,7 @@ require (
|
||||
github.com/samber/lo v1.38.1 // indirect
|
||||
github.com/sergi/go-diff v1.2.0 // indirect
|
||||
github.com/stretchr/testify v1.8.4 // indirect
|
||||
github.com/wailsapp/go-webview2 v1.0.7 // indirect
|
||||
github.com/wailsapp/go-webview2 v1.0.8-0.20231010092311-42cbb98eb53b // indirect
|
||||
github.com/wailsapp/mimetype v1.4.1 // indirect
|
||||
github.com/xanzy/ssh-agent v0.3.0 // indirect
|
||||
golang.org/x/crypto v0.9.0 // indirect
|
||||
|
@ -105,6 +105,7 @@ github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcU
|
||||
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
|
||||
github.com/wailsapp/go-webview2 v1.0.7 h1:s95+7irJsAsTy1RsjJ6N0cYX7tZ4gP7Uzawds0L2urs=
|
||||
github.com/wailsapp/go-webview2 v1.0.7/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
|
||||
github.com/wailsapp/go-webview2 v1.0.8-0.20231010092311-42cbb98eb53b/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
|
||||
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
|
||||
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
|
||||
github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI=
|
||||
|
@ -29,7 +29,7 @@ require (
|
||||
github.com/pterm/pterm v0.12.51
|
||||
github.com/samber/lo v1.38.1
|
||||
github.com/tc-hib/winres v0.1.6
|
||||
github.com/wailsapp/go-webview2 v1.0.7
|
||||
github.com/wailsapp/go-webview2 v1.0.8
|
||||
github.com/wailsapp/mimetype v1.4.1
|
||||
golang.org/x/net v0.10.0
|
||||
golang.org/x/sys v0.13.0
|
||||
|
12
v3/go.sum
12
v3/go.sum
@ -111,8 +111,6 @@ github.com/go-ole/go-ole v1.2.6 h1:/Fpf6oFPoeFik9ty7siob0G6Ke8QvQEuVcuChpwXzpY=
|
||||
github.com/go-ole/go-ole v1.2.6/go.mod h1:pprOEPIfldk/42T2oK7lQ4v4JSDwmV0As9GaiUsvbm0=
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI=
|
||||
github.com/go-task/slim-sprig/v3 v3.0.0/go.mod h1:W848ghGpv3Qj3dhTPRyJypKRiqCdHZiAzKg9hl15HA8=
|
||||
github.com/go-task/task/v3 v3.30.1 h1:HdfCTAJDHoWL3+3RyY+o+0IK1O5xQaSBrZIq2SKOQ84=
|
||||
github.com/go-task/task/v3 v3.30.1/go.mod h1:QPFn/f18HEmOhbuBYhlQOXX6ZogqzjQz31GA45uZ0mI=
|
||||
github.com/go-task/task/v3 v3.31.0 h1:o6iyj9gPJXxvxPi/u/l8e025PmM2BqKgtLNPS2i7hV4=
|
||||
github.com/go-task/task/v3 v3.31.0/go.mod h1:/CPDAu9nS3+soqY/e1tTrSo/zxk76lnljEV9aBTeKrg=
|
||||
github.com/goccy/go-json v0.9.6/go.mod h1:6MelG93GURQebXPDq3khkgXZkazVtN9CRI+MGFi0w8I=
|
||||
@ -338,8 +336,8 @@ github.com/tc-hib/winres v0.1.6 h1:qgsYHze+BxQPEYilxIz/KCQGaClvI2+yLBAZs+3+0B8=
|
||||
github.com/tc-hib/winres v0.1.6/go.mod h1:pe6dOR40VOrGz8PkzreVKNvEKnlE8t4yR8A8naL+t7A=
|
||||
github.com/tmclane/purego v0.0.0-20230818202843-0b72c8c9140f h1:/HXk9aFXP97CJRzOIphm4pzySmJLqIMhKu1kD5usz1E=
|
||||
github.com/tmclane/purego v0.0.0-20230818202843-0b72c8c9140f/go.mod h1:ah1In8AOtksoNK6yk5z1HTJeUkC1Ez4Wk2idgGslMwQ=
|
||||
github.com/wailsapp/go-webview2 v1.0.7 h1:s95+7irJsAsTy1RsjJ6N0cYX7tZ4gP7Uzawds0L2urs=
|
||||
github.com/wailsapp/go-webview2 v1.0.7/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
|
||||
github.com/wailsapp/go-webview2 v1.0.8 h1:hyoFPlMSfb/NM64wuVbgBaq1MASJjqsSUYhN+Rbcr9Y=
|
||||
github.com/wailsapp/go-webview2 v1.0.8/go.mod h1:Uk2BePfCRzttBBjFrBmqKGJd41P6QIHeV9kTgIeOZNo=
|
||||
github.com/wailsapp/mimetype v1.4.1 h1:pQN9ycO7uo4vsUUuPeHEYoUkLVkaRntMnHJxVwYhwHs=
|
||||
github.com/wailsapp/mimetype v1.4.1/go.mod h1:9aV5k31bBOv5z6u+QP8TltzvNGJPmNJD4XlAL3U+j3o=
|
||||
github.com/xanzy/ssh-agent v0.3.0 h1:wUMzuKtKilRgBAD1sUb8gOwwRr2FGoBVumcjoOACClI=
|
||||
@ -461,8 +459,6 @@ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJ
|
||||
golang.org/x/sync v0.0.0-20200317015054-43a5402ce75a/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
||||
golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E=
|
||||
golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sync v0.4.0 h1:zxkM55ReGkDlKSM+Fu41A+zmbZuaPVbGMzvvdUPznYQ=
|
||||
golang.org/x/sync v0.4.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y=
|
||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
||||
@ -509,16 +505,12 @@ golang.org/x/sys v0.0.0-20220704084225-05e143d24a9e/go.mod h1:oPkhp1MJrh7nUepCBc
|
||||
golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.12.0 h1:CM0HF96J0hcLAwsHPJZjfdNzs0gftsLfgKt57wWHJ0o=
|
||||
golang.org/x/sys v0.12.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/sys v0.13.0 h1:Af8nKPmuFypiUBjVoU9V20FiaFXOcuZI21p0ycVYYGE=
|
||||
golang.org/x/sys v0.13.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||
golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210220032956-6a3ed077a48d/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
|
||||
golang.org/x/term v0.0.0-20210615171337-6886f2dfbf5b/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
|
||||
golang.org/x/term v0.12.0 h1:/ZfYdc3zq+q02Rv9vGqTeSItdzZTSNDmfTi0mBAuidU=
|
||||
golang.org/x/term v0.12.0/go.mod h1:owVbMEjm3cBLCHdkQu9b1opXd4ETQWc3BhuQGKgXgvU=
|
||||
golang.org/x/term v0.13.0 h1:bb+I9cTfFazGW51MZqBVmZy7+JEJMouUHTUSKVQLBek=
|
||||
golang.org/x/term v0.13.0/go.mod h1:LTmsnFJwVN6bCy1rVCoS+qHT1HhALEFxKncY3WNNh4U=
|
||||
golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
||||
|
@ -7,6 +7,7 @@ export const EventTypes = {
|
||||
APMResumeAutomatic: "windows:APMResumeAutomatic",
|
||||
APMResumeSuspend: "windows:APMResumeSuspend",
|
||||
APMPowerSettingChange: "windows:APMPowerSettingChange",
|
||||
ApplicationStarted: "windows:ApplicationStarted",
|
||||
WebViewNavigationCompleted: "windows:WebViewNavigationCompleted",
|
||||
WindowInactive: "windows:WindowInactive",
|
||||
WindowActive: "windows:WindowActive",
|
||||
|
@ -180,7 +180,11 @@ func (m *windowsApp) run() error {
|
||||
for eventID := range m.parent.applicationEventListeners {
|
||||
m.on(eventID)
|
||||
}
|
||||
|
||||
// Emit application started event
|
||||
applicationEvents <- &Event{
|
||||
Id: uint(events.Windows.ApplicationStarted),
|
||||
ctx: blankApplicationEventContext,
|
||||
}
|
||||
_ = m.runMainLoop()
|
||||
|
||||
return nil
|
||||
|
@ -6,6 +6,7 @@ import "github.com/wailsapp/wails/v3/pkg/events"
|
||||
|
||||
var commonApplicationEventMap = map[events.ApplicationEventType]events.ApplicationEventType{
|
||||
events.Windows.SystemThemeChanged: events.Common.ThemeChanged,
|
||||
events.Windows.ApplicationStarted: events.Common.ApplicationStarted,
|
||||
}
|
||||
|
||||
func (m *windowsApp) setupCommonEvents() {
|
||||
|
@ -35,6 +35,6 @@ func (m *MessageProcessor) processEventsMethod(method int, rw http.ResponseWrite
|
||||
return
|
||||
}
|
||||
|
||||
m.Info("Runtime:", "method", "Events."+eventsMethodNames[method], "event", event)
|
||||
m.Info("Runtime:", "method", "Events."+eventsMethodNames[method], "name", event.Name, "sender", event.Sender, "data", event.Data, "cancelled", event.Cancelled)
|
||||
|
||||
}
|
||||
|
@ -1025,7 +1025,9 @@ func (w *WebviewWindow) OpenContextMenu(data *ContextMenuData) {
|
||||
if w.impl == nil {
|
||||
return
|
||||
}
|
||||
w.impl.openContextMenu(menu, data)
|
||||
InvokeSync(func() {
|
||||
w.impl.openContextMenu(menu, data)
|
||||
})
|
||||
}
|
||||
|
||||
// RegisterContextMenu registers a context menu and assigns it the given name.
|
||||
|
@ -815,6 +815,7 @@ func newWindowImpl(parent *WebviewWindow) *windowsWebviewWindow {
|
||||
func (w *windowsWebviewWindow) openContextMenu(menu *Menu, _ *ContextMenuData) {
|
||||
// Create the menu
|
||||
thisMenu := NewPopupMenu(w.hwnd, menu)
|
||||
thisMenu.Update()
|
||||
w.currentlyOpenContextMenu = thisMenu
|
||||
thisMenu.ShowAtCursor()
|
||||
}
|
||||
@ -1260,8 +1261,8 @@ func (w *windowsWebviewWindow) processRequest(req *edge.ICoreWebView2WebResource
|
||||
|
||||
webviewRequests <- &webViewAssetRequest{
|
||||
Request: webviewRequest,
|
||||
windowId: uint(windowID),
|
||||
windowName: globalApplication.getWindowForID(uint(windowID)).Name(),
|
||||
windowId: w.parent.id,
|
||||
windowName: globalApplication.getWindowForID(w.parent.id).Name(),
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -33,25 +33,25 @@ type commonEvents struct {
|
||||
|
||||
func newCommonEvents() commonEvents {
|
||||
return commonEvents{
|
||||
ApplicationStarted: 1167,
|
||||
WindowMaximise: 1168,
|
||||
WindowUnMaximise: 1169,
|
||||
WindowFullscreen: 1170,
|
||||
WindowUnFullscreen: 1171,
|
||||
WindowRestore: 1172,
|
||||
WindowMinimise: 1173,
|
||||
WindowUnMinimise: 1174,
|
||||
WindowClosing: 1175,
|
||||
WindowZoom: 1176,
|
||||
WindowZoomIn: 1177,
|
||||
WindowZoomOut: 1178,
|
||||
WindowZoomReset: 1179,
|
||||
WindowFocus: 1180,
|
||||
WindowLostFocus: 1181,
|
||||
WindowShow: 1182,
|
||||
WindowHide: 1183,
|
||||
WindowDPIChanged: 1184,
|
||||
ThemeChanged: 1185,
|
||||
ApplicationStarted: 1168,
|
||||
WindowMaximise: 1169,
|
||||
WindowUnMaximise: 1170,
|
||||
WindowFullscreen: 1171,
|
||||
WindowUnFullscreen: 1172,
|
||||
WindowRestore: 1173,
|
||||
WindowMinimise: 1174,
|
||||
WindowUnMinimise: 1175,
|
||||
WindowClosing: 1176,
|
||||
WindowZoom: 1177,
|
||||
WindowZoomIn: 1178,
|
||||
WindowZoomOut: 1179,
|
||||
WindowZoomReset: 1180,
|
||||
WindowFocus: 1181,
|
||||
WindowLostFocus: 1182,
|
||||
WindowShow: 1183,
|
||||
WindowHide: 1184,
|
||||
WindowDPIChanged: 1185,
|
||||
ThemeChanged: 1186,
|
||||
}
|
||||
}
|
||||
|
||||
@ -320,6 +320,7 @@ type windowsEvents struct {
|
||||
APMResumeAutomatic ApplicationEventType
|
||||
APMResumeSuspend ApplicationEventType
|
||||
APMPowerSettingChange ApplicationEventType
|
||||
ApplicationStarted ApplicationEventType
|
||||
WebViewNavigationCompleted WindowEventType
|
||||
WindowInactive WindowEventType
|
||||
WindowActive WindowEventType
|
||||
@ -344,20 +345,21 @@ func newWindowsEvents() windowsEvents {
|
||||
APMResumeAutomatic: 1150,
|
||||
APMResumeSuspend: 1151,
|
||||
APMPowerSettingChange: 1152,
|
||||
WebViewNavigationCompleted: 1153,
|
||||
WindowInactive: 1154,
|
||||
WindowActive: 1155,
|
||||
WindowClickActive: 1156,
|
||||
WindowMaximise: 1157,
|
||||
WindowUnMaximise: 1158,
|
||||
WindowFullscreen: 1159,
|
||||
WindowUnFullscreen: 1160,
|
||||
WindowRestore: 1161,
|
||||
WindowMinimise: 1162,
|
||||
WindowUnMinimise: 1163,
|
||||
WindowClose: 1164,
|
||||
WindowSetFocus: 1165,
|
||||
WindowKillFocus: 1166,
|
||||
ApplicationStarted: 1153,
|
||||
WebViewNavigationCompleted: 1154,
|
||||
WindowInactive: 1155,
|
||||
WindowActive: 1156,
|
||||
WindowClickActive: 1157,
|
||||
WindowMaximise: 1158,
|
||||
WindowUnMaximise: 1159,
|
||||
WindowFullscreen: 1160,
|
||||
WindowUnFullscreen: 1161,
|
||||
WindowRestore: 1162,
|
||||
WindowMinimise: 1163,
|
||||
WindowUnMinimise: 1164,
|
||||
WindowClose: 1165,
|
||||
WindowSetFocus: 1166,
|
||||
WindowKillFocus: 1167,
|
||||
}
|
||||
}
|
||||
|
||||
@ -495,37 +497,38 @@ var eventToJS = map[uint]string{
|
||||
1150: "windows:APMResumeAutomatic",
|
||||
1151: "windows:APMResumeSuspend",
|
||||
1152: "windows:APMPowerSettingChange",
|
||||
1153: "windows:WebViewNavigationCompleted",
|
||||
1154: "windows:WindowInactive",
|
||||
1155: "windows:WindowActive",
|
||||
1156: "windows:WindowClickActive",
|
||||
1157: "windows:WindowMaximise",
|
||||
1158: "windows:WindowUnMaximise",
|
||||
1159: "windows:WindowFullscreen",
|
||||
1160: "windows:WindowUnFullscreen",
|
||||
1161: "windows:WindowRestore",
|
||||
1162: "windows:WindowMinimise",
|
||||
1163: "windows:WindowUnMinimise",
|
||||
1164: "windows:WindowClose",
|
||||
1165: "windows:WindowSetFocus",
|
||||
1166: "windows:WindowKillFocus",
|
||||
1167: "common:ApplicationStarted",
|
||||
1168: "common:WindowMaximise",
|
||||
1169: "common:WindowUnMaximise",
|
||||
1170: "common:WindowFullscreen",
|
||||
1171: "common:WindowUnFullscreen",
|
||||
1172: "common:WindowRestore",
|
||||
1173: "common:WindowMinimise",
|
||||
1174: "common:WindowUnMinimise",
|
||||
1175: "common:WindowClosing",
|
||||
1176: "common:WindowZoom",
|
||||
1177: "common:WindowZoomIn",
|
||||
1178: "common:WindowZoomOut",
|
||||
1179: "common:WindowZoomReset",
|
||||
1180: "common:WindowFocus",
|
||||
1181: "common:WindowLostFocus",
|
||||
1182: "common:WindowShow",
|
||||
1183: "common:WindowHide",
|
||||
1184: "common:WindowDPIChanged",
|
||||
1185: "common:ThemeChanged",
|
||||
1153: "windows:ApplicationStarted",
|
||||
1154: "windows:WebViewNavigationCompleted",
|
||||
1155: "windows:WindowInactive",
|
||||
1156: "windows:WindowActive",
|
||||
1157: "windows:WindowClickActive",
|
||||
1158: "windows:WindowMaximise",
|
||||
1159: "windows:WindowUnMaximise",
|
||||
1160: "windows:WindowFullscreen",
|
||||
1161: "windows:WindowUnFullscreen",
|
||||
1162: "windows:WindowRestore",
|
||||
1163: "windows:WindowMinimise",
|
||||
1164: "windows:WindowUnMinimise",
|
||||
1165: "windows:WindowClose",
|
||||
1166: "windows:WindowSetFocus",
|
||||
1167: "windows:WindowKillFocus",
|
||||
1168: "common:ApplicationStarted",
|
||||
1169: "common:WindowMaximise",
|
||||
1170: "common:WindowUnMaximise",
|
||||
1171: "common:WindowFullscreen",
|
||||
1172: "common:WindowUnFullscreen",
|
||||
1173: "common:WindowRestore",
|
||||
1174: "common:WindowMinimise",
|
||||
1175: "common:WindowUnMinimise",
|
||||
1176: "common:WindowClosing",
|
||||
1177: "common:WindowZoom",
|
||||
1178: "common:WindowZoomIn",
|
||||
1179: "common:WindowZoomOut",
|
||||
1180: "common:WindowZoomReset",
|
||||
1181: "common:WindowFocus",
|
||||
1182: "common:WindowLostFocus",
|
||||
1183: "common:WindowShow",
|
||||
1184: "common:WindowHide",
|
||||
1185: "common:WindowDPIChanged",
|
||||
1186: "common:ThemeChanged",
|
||||
}
|
||||
|
@ -127,6 +127,7 @@ windows:APMSuspend
|
||||
windows:APMResumeAutomatic
|
||||
windows:APMResumeSuspend
|
||||
windows:APMPowerSettingChange
|
||||
windows:ApplicationStarted
|
||||
windows:WebViewNavigationCompleted
|
||||
windows:WindowInactive
|
||||
windows:WindowActive
|
||||
|
Loading…
Reference in New Issue
Block a user