Power save mode. Allow user call RequestRedraw to redraw a new frame. #5140
+173
−43
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This is a new try inspired by the pull request of #5116.
This new approach allows the user to choose which mode to use by specifying the timeout.
To tryout, please set the timeout value to -1 and open the Tools->Matics/Debugger to see how many frames are drawed when you interact with the demo.
Sample of code in the file of main.cpp to enable/disable power save. The default timeout value is 0 which keeps current ImGui no blocking behavior. Users can change it as needed.
This PR also allows users to request a redraw on demand. For example, the Widgets/Plotting/ProgressBar animation calls this
ImGui::RequestRedraw(ImGuiRedrawFlags_Everything)
to animate the progress bar change.ImGuiRedrawFlags
is an enum currently only implemented the redraw for everything. We can implement redraw for specific window or region of a window in the future.Currently, only tested on Windows works well for all backends. Any feedback or suggestions on Linux and Mac are welcomed.