Skip to content
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

Ui not redrawing correctly when using WinitSettings::desktop_app() #292

Closed
ThomasAlban opened this issue Jul 6, 2024 · 13 comments
Closed

Comments

@ThomasAlban
Copy link

Hi,
this issue was fixed a few months ago in #240 but it seems to have cropped back up ever since I updated to bevy 0.14. I'm using WinitSettings::desktop_app(), and when e.g. clicking a button, the UI does not redraw until I move the mouse.
This might have been broken by #278!

@ThomasAlban
Copy link
Author

ThomasAlban commented Jul 6, 2024

Here is a demonstration of the issue. When I click a button, it only appears blue after I wiggle the mouse:

Untitled.mp4

mvlabat added a commit that referenced this issue Jul 7, 2024
@mvlabat
Copy link
Owner

mvlabat commented Jul 7, 2024

Hi! I'm sorry to hear the update has broken the redraw functionality for you.
Could you help me to reproduce the issue? I've tried to come up with an example based on your description, but I guess I'm missing something because it's still working for me. Can you please take a look at #293? Feel free to suggest edits.

@ThomasAlban
Copy link
Author

Hi,
Thanks very much for attempting to reproduce the issue. Weird that it works for you but not for me!
I've also had another redraw issue elsewhere in my project ever since I updated:
I have a flycam which uses WASD to move. Normally holding a key doesn't continuously trigger redraws, so I added a piece of code to the fly cam system to check if the keys are pressed and if so send a redraw event. This always worked in previous versions, but now there's a delay of half a second before the redraws are sent, which is very odd.
I'm going to do some more investigating into this, but it could even be that this issue is nothing to do with bevy_egui! Do you have any idea what could be happening to cause these things breaking?

@mvlabat
Copy link
Owner

mvlabat commented Jul 17, 2024

No idea atm. :(
Have you tried running the example from the linked MR? I'm wondering if it works ok for you. If you can reproduce the issue there, that means the problem might be platform-specific. If not, then it means I've come up with a wrong example.

@jabuwu
Copy link

jabuwu commented Jul 22, 2024

I'm having the issue as well, with that PR (#293). MacOS.

Screen.Recording.2024-07-22.at.5.15.49.PM.mov

I was coming at this issue from a different angle. I have a particular interest in spinners continuing to work after this change. if I add a spinner, you can see the buttons behave properly.

Screen.Recording.2024-07-22.at.5.16.27.PM.mov

Which makes sense, because spinners cause constant redraws. I will try to investigate this further.

@ThomasAlban
Copy link
Author

@jabuwu ah brilliant, I'm on macOS (M1) as well so it seems like it could be a Mac-related issue! I'll have to test the example and see if the issue still occurs, will let you know the results

@mvlabat
Copy link
Owner

mvlabat commented Jul 24, 2024

The thing is, I'm also on MacOS, and I still couldn't reproduce it. Now I can though. I don't know what has changed, maybe I was just unlucky or clumsy with my trackpad (e.g. moving the pointer accidentally after pressing a button), but that gives an opportunity to debug it at least 🙃

@ThomasAlban
Copy link
Author

ThomasAlban commented Jul 27, 2024

Just tested your example, and I can reproduce the issue - but only some of the time - sometimes when I click, everything works fine, and other times it doesn't fire enough redraws to show the button becoming blue. So seems like a luck thing, maybe the frequency of the issue happening is influenced by things like the refresh rate or your monitor or maybe ui complexity in the project.....? I can tell you that in my project it happens p much 100% of the time, and the UI there is quite a lot more complex

@mvlabat
Copy link
Owner

mvlabat commented Jul 28, 2024

I've just pushed another commit to #293 that should fix the issue. Please let me know if it indeed fixes it for you.

@Maximetinu if you can double-check that it doesn't break redraws again, I'll also be grateful :D

@ThomasAlban
Copy link
Author

Yes, that fixes it for me. Thank you!

@Maximetinu
Copy link
Contributor

@Maximetinu if you can double-check that it doesn't break redraws again, I'll also be grateful :D

I just double checked, it doesn't!

@Maximetinu
Copy link
Contributor

Maximetinu commented Jul 29, 2024

It'd be nice writing an automatic test to cover this, replicating the repro steps that I described in #277

Given that no egui systems are running
When I move the cursor on top of the screen
Then no RequestRedraw event is sent

The given and the then are easy to set up in code, but I don't know how I can simulate the when reliably with no real window 🤔

Sending a CursorMoved event myself tricks the EguiPlugin to think that the cursor moved, but the EguiPlugin panics if I add it in a unit test with no real window.

mvlabat added a commit that referenced this issue Jul 30, 2024
* Attempt to reproduce #292

* Fix repaint corner cases
yrns added a commit to yrns/runic that referenced this issue Aug 3, 2024
Drag release doesn't seem to trigger a redraw.

See: mvlabat/bevy_egui#292
@mvlabat
Copy link
Owner

mvlabat commented Aug 18, 2024

The initial issue seems to be fixed. But there may be other issues related to the energy saving settings: #295, #302.

@mvlabat mvlabat closed this as completed Aug 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants