mirror of
https://github.com/wailsapp/wails.git
synced 2025-05-02 08:41:41 +08:00
Fix right mouse button event (#2190)
This commit is contained in:
parent
38ffbb3161
commit
e57bfe002a
@ -165,7 +165,6 @@ float xroot = 0.0f;
|
||||
float yroot = 0.0f;
|
||||
int dragTime = -1;
|
||||
uint mouseButton = 0;
|
||||
bool contextMenuDisabled = false;
|
||||
|
||||
gboolean buttonPress(GtkWidget *widget, GdkEventButton *event, void* dummy)
|
||||
{
|
||||
@ -175,8 +174,8 @@ gboolean buttonPress(GtkWidget *widget, GdkEventButton *event, void* dummy)
|
||||
return FALSE;
|
||||
}
|
||||
mouseButton = event->button;
|
||||
if( event->button == 3 && contextMenuDisabled ) {
|
||||
return TRUE;
|
||||
if( event->button == 3 ) {
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
if (event->type == GDK_BUTTON_PRESS && event->button == 1)
|
||||
@ -605,12 +604,15 @@ gboolean UnFullscreen(gpointer data) {
|
||||
return G_SOURCE_REMOVE;
|
||||
}
|
||||
|
||||
bool disableContextMenu(GtkWindow* window) {
|
||||
|
||||
// function to disable the context menu but propogate the event
|
||||
gboolean disableContextMenu(GtkWidget *widget, WebKitContextMenu *context_menu, GdkEvent *event, WebKitHitTestResult *hit_test_result, gpointer data) {
|
||||
// return true to disable the context menu
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
void DisableContextMenu(void* webview) {
|
||||
contextMenuDisabled = TRUE;
|
||||
// Disable the context menu but propogate the event
|
||||
g_signal_connect(WEBKIT_WEB_VIEW(webview), "context-menu", G_CALLBACK(disableContextMenu), NULL);
|
||||
}
|
||||
|
||||
|
83
v2/internal/platform/systray/systray_linux.go
Normal file
83
v2/internal/platform/systray/systray_linux.go
Normal file
@ -0,0 +1,83 @@
|
||||
//go:build linux
|
||||
|
||||
/*
|
||||
* Based on code originally from https://github.com/tadvi/systray. Copyright (C) 2019 The Systray Authors. All Rights Reserved.
|
||||
*/
|
||||
|
||||
package systray
|
||||
|
||||
import (
|
||||
"github.com/wailsapp/wails/v2/pkg/menu"
|
||||
"github.com/wailsapp/wails/v2/pkg/options"
|
||||
)
|
||||
|
||||
type Systray struct {
|
||||
}
|
||||
|
||||
func (p *Systray) Close() {
|
||||
err := p.Stop()
|
||||
if err != nil {
|
||||
println(err.Error())
|
||||
}
|
||||
}
|
||||
|
||||
func (p *Systray) Update() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
// SetTitle is unused on Windows
|
||||
func (p *Systray) SetTitle(_ string) {}
|
||||
|
||||
func New() (*Systray, error) {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
func (p *Systray) SetMenu(popupMenu *menu.Menu) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
func (p *Systray) Stop() error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Systray) OnLeftClick(fn func()) {
|
||||
}
|
||||
|
||||
func (p *Systray) OnRightClick(fn func()) {
|
||||
}
|
||||
|
||||
func (p *Systray) OnLeftDoubleClick(fn func()) {
|
||||
}
|
||||
|
||||
func (p *Systray) OnRightDoubleClick(fn func()) {
|
||||
}
|
||||
|
||||
func (p *Systray) OnMenuClose(fn func()) {
|
||||
}
|
||||
|
||||
func (p *Systray) OnMenuOpen(fn func()) {
|
||||
}
|
||||
|
||||
func (p *Systray) SetTooltip(tooltip string) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Systray) Show() error {
|
||||
return p.setVisible(true)
|
||||
}
|
||||
|
||||
func (p *Systray) Hide() error {
|
||||
return p.setVisible(false)
|
||||
}
|
||||
|
||||
func (p *Systray) setVisible(visible bool) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Systray) SetIcons(lightModeIcon, darkModeIcon *options.SystemTrayIcon) error {
|
||||
return nil
|
||||
}
|
||||
|
||||
func (p *Systray) Run() error {
|
||||
return nil
|
||||
}
|
Loading…
Reference in New Issue
Block a user