Skip to content

Commit

Permalink
Support multiple mouse buttons combined
Browse files Browse the repository at this point in the history
Also remove old comment - that was supposed to reserve the iota, but
it got broken some time ago
Fixes fyne-io#1533
  • Loading branch information
andydotxyz committed Nov 14, 2020
1 parent f76a3c4 commit e782df6
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 6 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Expand Up @@ -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
Expand Down
5 changes: 1 addition & 4 deletions driver/desktop/mouse.go
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions internal/driver/glfw/window.go
Expand Up @@ -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 {
Expand Down

0 comments on commit e782df6

Please sign in to comment.