The problem is that the cairo context in olny available inside the on_draw function. And I don't know which takes longer: creating a path using move_to and line_to methods, or stroking the path.
2014-07-27 11:43 GMT+03:00 fr33domlover <fr33domlo...@mailoo.org>: > On Sat, 26 Jul 2014 19:50:58 +0300 > Szőke Szabolcs <szabolcs...@gmail.com> wrote: > > > Hi everybody. I found the tutorial on gtkmm developer page about > > multi-threading. But when I wanted to adapt for my needs, I couldn't > > figure out how to do it. I have a DrawingArea widget within a window > > and I want to do the drawing in separate thread because as the > > drawing became more complex, the gui thread gets locked every time > > when something is drawn. I know the theory: I should use a Dispatcher > > to send the data to gui thread, but in tutorial I saw that when the > > worker thread completed the job, the gui thread is notified. But I > > can't do that, or at least I don't know how to do that in this > > situation. Any help will be appreciated. > > > > I don't know much about gtkmm or threads, but I would start by trying to > use a worker thread that sleeps until notified by the GUI thread, then > draws, and notifies the GUI thread that it's done and goes back to > sleep. It means both threads need to be able to notify each other. > > Another (probably the "naive" approach) option is to spawn a worker > thread for each redraw. But I don't think it's good for scalability. > > A possible problem is that the drawing is a GUI related operation, and > I'm not sure it's safe to draw to the Cairo surface from the worker > thread. I hope someone else here can clarify this point. > > I'm not a regular gtkmm user though. This is just some basic ideas. > > > -- fr33 >
_______________________________________________ gtkmm-list mailing list gtkmm-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtkmm-list