Skip to content

Commit

Permalink
Merge branch 'release/v2.0.x' of github.com:fyne-io/fyne into release…
Browse files Browse the repository at this point in the history
…/v2.0.x
  • Loading branch information
andydotxyz committed Mar 26, 2021
2 parents 43350b2 + 44bc05b commit 5b55066
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions internal/driver/glfw/window.go
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,11 @@ func (w *window) mouseOut() {
}

func (w *window) mouseClicked(_ *glfw.Window, btn glfw.MouseButton, action glfw.Action, mods glfw.ModifierKey) {
if w.mousePos.IsZero() { // window may not be focused (darwin mostly) and so position callbacks not happening
xpos, ypos := w.viewport.GetCursorPos()
w.mousePos = fyne.NewPos(internal.UnscaleInt(w.canvas, int(xpos)), internal.UnscaleInt(w.canvas, int(ypos)))
}

co, pos, _ := w.findObjectAtPositionMatching(w.canvas, w.mousePos, func(object fyne.CanvasObject) bool {
switch object.(type) {
case fyne.Tappable, fyne.SecondaryTappable, fyne.DoubleTappable, fyne.Focusable, desktop.Mouseable, desktop.Hoverable:
Expand Down Expand Up @@ -1184,6 +1189,7 @@ func (w *window) focused(_ *glfw.Window, isFocused bool) {
w.canvas.FocusGained()
} else {
w.canvas.FocusLost()
w.mousePos = fyne.Position{}
}
}

Expand Down

0 comments on commit 5b55066

Please sign in to comment.