-
Notifications
You must be signed in to change notification settings - Fork 172
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
Events not handled when apps start without focus #212
Comments
Little Update on this issue. I have tested my program on linux and this problem doesn't happen. I think it's because no matter what I do, the window of my program always shows on top of my desktop when it start. |
Hi Yasso9. Thanks for reporting this. It is indeed an issue specific to imgui-sfml and not imgui in general. There's another issue for it here, #206 |
Yep, looks similar. I'll get to it some day (maybe on weekends?), kinda busy with real life stuff, unfortunately. |
It'd be great if this can be fixed relatively soon. We use this library (and a very good one!) for our project and we were having the issue of imgui not "receiving" any events when we launch our app from time to time. It's good that we finally found the cause :) |
@sam20908 If you want a quick fix before a better one comes along, just change line 217 of this file to
https://github.com/eliasdaler/imgui-sfml/blob/master/imgui-SFML.cpp#L217 |
Thanks a lot for your answers and solutions ! |
Sorry, this is a pretty big change to old behaviour so I can't promise a quick fix. |
On Windows I noticed the following when getting this issue constantly. Firstly it the window always launches without focus, then when I click into it there's no input on my
I was wondering would it be worth to add a backup check into if (s_currWindowCtx->windowHasFocus != window.hasFocus())
s_currWindowCtx->windowHasFocus = window.hasFocus(); (Edit: This does actually resolve the issue well enough for me to not have to worry about it while working on my project) |
I applied the same change @Bambo-Borris mentioned to fix the issue, for me and the users of my engine it happened very often |
Any chance of an update for this? I'm running into the same issue constantly. For now I'm patching locally as suggested by @Bambo-Borris |
I guess it would be better to stop caching window's focus in windowHasFocus variable and instead call Window::hasFocus where needed. PRs are welcome! |
Workaround for SFML/imgui-sfml#212
Hello,
When I start the app without focus (e.g. when I click anywhere in my screen before the window to show) I cannot drag window, click on buttons and all imgui events aren't available.
I can reproduce the error with the basic example given in the readme.md. I am on windows and the error happen with both g++ 11.2.0 and clang++ 13.0.0. I haven't tested with other compilers.
I don't know if it's the right place to tell that or if I must say it on the general imgui repository.
Besides that everything works perfectly.
The text was updated successfully, but these errors were encountered: