Skip to content

Commit 0dd73e2

Browse files
authored
Revert "Remove OpenContextMenu" (#3524)
This reverts commit 54140e9.
1 parent 54140e9 commit 0dd73e2

File tree

2 files changed

+20
-0
lines changed

2 files changed

+20
-0
lines changed

v3/pkg/application/webview_window.go

+19
Original file line numberDiff line numberDiff line change
@@ -1094,6 +1094,25 @@ func (w *WebviewWindow) HandleDragAndDropMessage(filenames []string) {
10941094
}
10951095
}
10961096

1097+
func (w *WebviewWindow) OpenContextMenu(data *ContextMenuData) {
1098+
menu, ok := w.contextMenus[data.Id]
1099+
if !ok {
1100+
// try application level context menu
1101+
menu, ok = globalApplication.getContextMenu(data.Id)
1102+
if !ok {
1103+
w.Error("No context menu found for id: %s", data.Id)
1104+
return
1105+
}
1106+
}
1107+
menu.setContextData(data)
1108+
if w.impl == nil && !w.isDestroyed() {
1109+
return
1110+
}
1111+
InvokeSync(func() {
1112+
w.impl.openContextMenu(menu, data)
1113+
})
1114+
}
1115+
10971116
// RegisterContextMenu registers a context menu and assigns it the given name.
10981117
func (w *WebviewWindow) RegisterContextMenu(name string, menu *Menu) {
10991118
w.contextMenusLock.Lock()

v3/pkg/application/window.go

+1
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ type Window interface {
4444
Minimise() Window
4545
Name() string
4646
On(eventType events.WindowEventType, callback func(event *WindowEvent)) func()
47+
OpenContextMenu(data *ContextMenuData)
4748
RegisterContextMenu(name string, menu *Menu)
4849
RelativePosition() (int, int)
4950
Reload()

0 commit comments

Comments
 (0)