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

Unnecessary re-render when moving windows in eframe #1979

Closed
Detector-I opened this issue Aug 28, 2022 · 4 comments · Fixed by #1980
Closed

Unnecessary re-render when moving windows in eframe #1979

Detector-I opened this issue Aug 28, 2022 · 4 comments · Fixed by #1980
Labels
bug Something is broken

Comments

@Detector-I
Copy link

Describe the bug

I don't know why but eframe will render gui in any mouse event on the program, even outside of the gui itself, like when moving the window by dragging titlebar...
I don't think that this behavior should be the default... because there is no need to render gui itself when just moving the windows...
other gui library like imgui (using example backends) wont re-render on this kind of events

To Reproduce

Steps to reproduce the behavior:

  1. Create any program with eframe
  2. Try to moving it by mouse (dragging windows titlebar)
  3. Check the CPU & GPU usage...

Expected behavior

eframe shouldn't re-render the gui when user simply moving the program window itself (and there isn't any input or update to gui itself)

Screenshots

image
no input or update in gui itself, just moving program windows (really fast...)

Desktop (please complete the following information):

  • OS: Windows 10

Additional context

The interesting thing is if we try to move the window using arrow key in keyboard using the option in windows menu (I can recall exact name of it) there is no re-render, because seems like eframe will render gui only on mouse events
image

@Detector-I Detector-I added the bug Something is broken label Aug 28, 2022
@JosuGZ
Copy link

JosuGZ commented Aug 28, 2022

I don't think this is a bug. But it would be nice to have better behavior.

I think it should be possible to keep data from the previous frame to decide whether a redraw is needed or not. Components would save there a bounding box of the area they are interested in along with the type of event (enter, leave, move...). Before rendering, the library could check if the mouse is interacting with those areas.

@Detector-I
Copy link
Author

@emilk thank you for fast respond.
I tested it but seems like it still re-render when moving window... there is something that im missing? (like I need to set an option or something?

@emilk
Copy link
Owner

emilk commented Aug 29, 2022

Use RUST_LOG=debug and eframe will log what event caused the repaint ("Repaint caused by …"). You'll have to take it from here, because on my mac it works as intended.

@Detector-I
Copy link
Author

Use RUST_LOG=debug and eframe will log what event caused the repaint ("Repaint caused by …"). You'll have to take it from here, because on my mac it works as intended.

thank you for the answer, I used $env:RUST_LOG="debug"; but still didn't get any debug output in my windows powershell...
I know its kind of outside of here but can you tell me how can I setup tracing?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something is broken
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants