From e782df68727362253d0ee6c756383543a7fc8c8a Mon Sep 17 00:00:00 2001 From: Andy Williams Date: Sat, 14 Nov 2020 15:20:15 +0000 Subject: [PATCH] Support multiple mouse buttons combined Also remove old comment - that was supposed to reserve the iota, but it got broken some time ago Fixes #1533 --- CHANGELOG.md | 1 + driver/desktop/mouse.go | 5 +---- internal/driver/glfw/window.go | 4 ++-- 3 files changed, 4 insertions(+), 6 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 4b8050843b..369540231c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -21,6 +21,7 @@ More detailed release notes can be found on the [releases page](https://github.c * Entry copy/paste is crashing on android 7.1 (#1511) * Fyne package creating invalid windows packages (#1521) * Menu bar initially doesn't respond to mouse input on macOS (#505) +* desktop.MouseHover Button state is not reliable (#1533) ## 1.4 - 1 November 2020 diff --git a/driver/desktop/mouse.go b/driver/desktop/mouse.go index 4da43f7014..c130ad1b98 100644 --- a/driver/desktop/mouse.go +++ b/driver/desktop/mouse.go @@ -7,10 +7,7 @@ type MouseButton int const ( // LeftMouseButton is the most common mouse button - on some systems the only one - LeftMouseButton MouseButton = iota + 1 - - // TODO: Expose this button - // middleMouseButton + LeftMouseButton MouseButton = 1 << iota // RightMouseButton is the secondary button on most mouse input devices. RightMouseButton diff --git a/internal/driver/glfw/window.go b/internal/driver/glfw/window.go index 37fb8d56bc..9ceb0d547f 100644 --- a/internal/driver/glfw/window.go +++ b/internal/driver/glfw/window.go @@ -682,9 +682,9 @@ func (w *window) mouseClicked(_ *glfw.Window, btn glfw.MouseButton, action glfw. } if action == glfw.Press { - w.mouseButton = button + w.mouseButton |= button } else if action == glfw.Release { - w.mouseButton = 0 + w.mouseButton &= ^button } if wid, ok := co.(fyne.Draggable); ok {