antoyo / relm

Idiomatic, GTK+-based, GUI library, inspired by Elm, written in Rust
MIT License
2.44k stars 78 forks source link

cairo::Context not working in relm's message-passing style #116

Closed nadirs closed 6 years ago

nadirs commented 6 years ago

When using a cairo::Context to draw on a gtk::DrawingArea, nothing is drawn if context is used in relm's message-passing-style callback (i.e. update method of trait Update).

I wrote an example test for this behavior here: https://github.com/nadirs/relm-cairo-test/

You can see the update method that should handle connect_draw here: https://github.com/nadirs/relm-cairo-test/blob/master/src/main.rs#L39 (usage of cairo::Context here does not work)

You can see that cairo::Context, used "immediately" in the connect_draw callback, does work: https://github.com/nadirs/relm-cairo-test/blob/master/src/main.rs#L83

Any idea?

P.S.: thank you for building relm!

antoyo commented 6 years ago

Duplicate of #57. For now, it's not supported and you need to use the gtk-way.