-
Notifications
You must be signed in to change notification settings - Fork 455
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Sometimes single clicks are not processed #1582
Comments
Does this happen with the official 11.3 macOS app (available here)? We can't really guarantee that software built using brew or other package managers is using the same dependencies LÖVE was tested with. |
For now I'm assuming it doesn't happen with the official app, but let me know if that's not true. |
I have this issue on the official release of 11.4a. It seems to correlate with program complexity (maybe frame rate) somehow, so as I develop, the probability of it happening increases. MacOS 12.5.1 (21G83), M1 MacBook Pro 14-inch, 2021. Official release Love 11.4a. The same behavior where single clicks, on some launches, do not register, but do register with double clicks. |
Are you using If you have some code or a .love that reproduces the issue for you that will help too. |
I'm using -- This code enters the broken mode for me about 3 out 8 trials.
InitLoops = 10000000
UpdateLoops = 10000000
DrawLoops = 10000000
ClickLoops = 10000000
Clicked = false
function love.load()
love.window.setMode( 1280,720, {highdpi = true})
local dummy = 0
for i = 1,InitLoops do
dummy = dummy*dummy
end
end
function love.update(dt)
local dummy = 0
for i = 1,UpdateLoops do
dummy = dummy*dummy
end
end
function love.draw()
local dummy = 0
for i = 1,DrawLoops do
dummy = dummy*dummy
end
love.graphics.print("Click Detected: " .. tostring(Clicked))
end
function love.mousepressed( x, y, button, istouch, presses )
local dummy = 0
for i = 1,ClickLoops do
dummy = dummy*dummy
end
Dummy:indirection()
end
Dummy = {}
function Dummy:indirection()
local dummy = 0
for i = 1,ClickLoops do
dummy = dummy*dummy
end
Clicked = true
end I will also say it is device/os dependent. I have a significantly more complex game I'm working on that enters this strange mode nearly half the time on my development machine, but the actual targeted device is an iPhone, and I've never had this problem with the same code run on Love on the iPhone. |
Ok, I decided to just toss up the video of the trials anyway here. This was recorded with Quicktime on my Mac with "show clicks" on, so my mouse cursor is surrounded with a circle each time I click the mouse. in 3 out of 8 trials in this recording it enters the mode where single clicking fails, but double clicking works -- hopefully reliable enough that someone else can repro! |
Thanks for the test code. I ran it 20 times on my laptop (x64 Macbook Pro from 2016, macOS 12.6) and haven't been able to reproduce it there. I'll try on an M1 machine later. |
I ran the test code a bunch of times on my M1 mac with both macOS 12.1 and macOS 13.1 and wasn't able to reproduce it there either. I wonder if some third-party software is interfering. I also noticed in your video that when it doesn't work, the window hasn't been fully focused (the close/minimize/maximize window buttons are greyed out whereas they have full colour in the tests where it does work). I suppose whatever is causing the issue is preventing the window from fully foregrounding itself or something. |
I ran additional testing and that is indeed the issue somehow. I've been able to get it out of the inoperable mode by minimizing then maximizing the window which then grants it full focus. Without additional evidence to the contrary, I think this has to be something third-party capturing the focus (although it happens with no other apps and it depends on the code being executed...). Thanks for working through this! |
I know this issue is closed, but @Koloth I found that this issue only happens when the game is starting up and I move my mouse. Who knows why, but I fix it by just not moving my mouse while the game is compiling before it loads. 😅 I wonder if it could have something to do with the IDE you're using? I'm using ZeroBrane Studio and I notice it does weird things with mouse focus sometimes. |
Just to add to the conversation, I've experienced this very same issue with my Mac M1. Exactly the same: only double clicks being processed, and the same issue with the window being unfocused. Maybe the issue comes from a dependency? |
@pherrymason What IDE are you using? I’ve come to be of the opinion that, for me, it is somehow VS Code taking back focus while the app is launching. This makes it code dependent (since it depends on the code launching time). Watching my own video back again, it does indeed look like I reach for the mouse earlier in those cases where the failure happens. So perhaps: something all these cases is doing leads to the original launching app retaking some of the focus. Problem is we have two different IDEs, or direct from the command line launching love2d or rust. This feels like something OS level to me. Very interesting. |
Thinking through it more: I guess what is happening in all these cases is that after the app launches, but before the window is created, a mouse event needs to be handled. This mouse event is sent to whatever is doing the launching which then puts the newly created window into a half-focused state, where clicking doesn’t grant the window focus, but it also doesn’t get the mouse click event (unless it is a double click???). There are still some mysteries here to be sure. In any case, I don’t think there is anything to do on the love2d side to fix it. |
I'm more inclined to think this is a OS bug, seeing the same issue being suffered across different projects on github:
|
Noticed the following, looks like Defold had the same issue and looks like they fixed it: defold/defold#7949 |
main.lua
Video: https://www.youtube.com/watch?v=4YGjKoG2H8w (may delete someday)
Behaviour:
On some game runs, Love processes only double clicks, single clicks won't work. Everything is back to normal after game restart.
Usually, it takes a lot of game restarts to reproduce the problem.
Expected behaviour:
Love always correctly processes single clicks.
Software:
Hardware:
I can provide additional info if needed.
I will also try to reproduce the problem with less software running as @slime73 suggested. There may be some third-party software interfering.
The text was updated successfully, but these errors were encountered: