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 UserInterface::draw? #241

Closed
kaimast opened this issue Mar 28, 2020 · 5 comments
Closed

Unnecessary UserInterface::draw? #241

kaimast opened this issue Mar 28, 2020 · 5 comments
Labels
improvement An internal improvement

Comments

@kaimast
Copy link
Contributor

kaimast commented Mar 28, 2020

Hi,

I am wondering whether this line in the example is correct:

https://github.com/hecrj/iced/blob/4d3afe2f0c6d42bb86248c1dbf5c5188e2b9e9ba/examples/integration/src/main.rs#L150

Why do I need to call draw even when the user_interface has not changed?

@kaimast
Copy link
Contributor Author

kaimast commented Mar 28, 2020

Oh I guess there could be some events, like resize, that don't get passed on to messages. If that's the case then maybe UserInterface::update should return some information on whether any state was changed?

@hecrj
Copy link
Member

hecrj commented Mar 28, 2020

If that's the case then maybe UserInterface::update should return some information on whether any state was changed?

Yes, this is something I have in mind! But I am waiting to see how other important parts related to event processing shape up (like layers and event capturing).

We are also calling view more times than necessary, as the Application widget tree should only be able to change after an update.

There is quite a bit of room for improvement when it comes to optimization (lazy widgets!), but I believe the complexity tradeoff is not worth it right now. At this stage, we want to keep things simple and be able to try different ideas easily.

@hecrj hecrj added the improvement An internal improvement label Mar 28, 2020
@kaimast
Copy link
Contributor Author

kaimast commented Mar 28, 2020

Yeah that makes sense. Feel free to close this.

@TianyiShi2001
Copy link

TianyiShi2001 commented Oct 25, 2020

(related to #30 and #579)

Are you aware of the crate cursive which is used to build text-user interface (TUI)? It supports layers and it redraws only upon registered event (and it has rules to determine which layer will consume the event). I guess it would be helpful to use cursive as a reference when implementing these features.

IMHO these features are really fundamental and are also likely to break a lot of existing code so they should be dealt with as soon as possible.

@kaimast
Copy link
Contributor Author

kaimast commented Jan 10, 2022

I think the wgpu/opengl integration has changed sufficiently for this to be closed.

There still be unnecessary redraws internally but they are not exposed to the user directly anymore.

@hecrj hecrj closed this as completed Jan 18, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement An internal improvement
Projects
None yet
Development

No branches or pull requests

3 participants