Closed swoolcock closed 2 years ago
Debug info:
print(love.window.hasFocus(), "love.mousemoved(x, y, dx, dy, istouch)", x, y, dx, dy, istouch)
// move mouse around and right clicked some points
true love.mousemoved(x, y, dx, dy, istouch) 126 0 0 0 false
...
true love.mousemoved(x, y, dx, dy, istouch) 57 117 0 1 false
true love.mousepressed(x, y, button, istouch, presses) 57 117 2 false 1
true love.mousereleased(x, y, button, istouch, presses) 57 117 2 false 1
true love.mousemoved(x, y, dx, dy, istouch) 57 118 0 1 false
...
true love.mousemoved(x, y, dx, dy, istouch) 85 202 -1 0 false
true love.mousepressed(x, y, button, istouch, presses) 85 202 2 false 1
true love.mousereleased(x, y, button, istouch, presses) 85 202 2 false 1
true love.mousemoved(x, y, dx, dy, istouch) 86 202 1 0 false
...
true love.mousemoved(x, y, dx, dy, istouch) 132 150 0 -1 false
true love.mousepressed(x, y, button, istouch, presses) 132 150 2 false 1
true love.mousereleased(x, y, button, istouch, presses) 132 150 2 false 1
true love.mousemoved(x, y, dx, dy, istouch) 132 151 0 1 false
...
true love.mousemoved(x, y, dx, dy, istouch) 0 510 -3 9 false
// left clicked outside window to drop focus, receives one mousemoved
false love.mousemoved(x, y, dx, dy, istouch) 0 510 0 0 false
// right clicked some different points inside window (note x,y is the same as the most recent mousemoved)
false love.mousepressed(x, y, button, istouch, presses) 0 510 2 false 1
false love.mousereleased(x, y, button, istouch, presses) 0 510 2 false 1
false love.mousepressed(x, y, button, istouch, presses) 0 510 2 false 1
false love.mousereleased(x, y, button, istouch, presses) 0 510 2 false 1
false love.mousepressed(x, y, button, istouch, presses) 0 510 2 false 1
false love.mousereleased(x, y, button, istouch, presses) 0 510 2 false 1
false love.mousepressed(x, y, button, istouch, presses) 0 510 2 false 1
false love.mousereleased(x, y, button, istouch, presses) 0 510 2 false 1
// right click drag with no focus (note the press x,y is incorrect)
false love.mousepressed(x, y, button, istouch, presses) 0 510 2 false 1
false love.mousemoved(x, y, dx, dy, istouch) 536 551 536 41 false
false love.mousemoved(x, y, dx, dy, istouch) 535 551 -1 0 false
false love.mousemoved(x, y, dx, dy, istouch) 534 551 -1 0 false
false love.mousereleased(x, y, button, istouch, presses) 534 551 2 false 0
// some more right clicks (note the x,y matches the mot recent mousemoved)
false love.mousepressed(x, y, button, istouch, presses) 534 551 2 false 1
false love.mousereleased(x, y, button, istouch, presses) 534 551 2 false 1
false love.mousepressed(x, y, button, istouch, presses) 534 551 2 false 1
false love.mousereleased(x, y, button, istouch, presses) 534 551 2 false 1
false love.mousepressed(x, y, button, istouch, presses) 534 551 2 false 1
false love.mousereleased(x, y, button, istouch, presses) 534 551 2 false 1
Right clicking a window in macOS does not give it the focus, but for whatever reason you can still interact with any context menus etc. that are displayed. Lönn does not handle this very well when dragging the map, as it ignores the initial click point and resets the drag every time you click. It's not fixed until the window regains the focus.
Simple solution: drop all mouse input on macOS if the window does not have the focus.
Example video, notice the issue happens when the window doesn't have focus:
https://user-images.githubusercontent.com/2331297/146624902-45b9d039-fdcc-494c-8ff4-29076b87f67a.mp4