> I am developing a program that has to draw some data using Cairo. The > question I have is about getting a cairo context from outside of the signal > "draw" that the examples describe. I have a multithreaded application where > one thread sets up the GTK drawing area, axes, tickmarks, etc. and another > thread has to draw in this area. I attach a function to a "draw" signal on > this GTK widget (drawing area) in one thread, but what do I do in another? The idiomatic way is to create a surface either using gdk_window_create_similar_surface(), or gdk_window_create_similar_image_surface(), which will take care of giving you the most appropriate surface for the platform you're using. You can usually do that from the main thread context, after realizing the widget in order to obtain its GdkWindow; you keep the surface inside your widget instance data, and draw on it from the thread you create for rendering. At the end of the thread, you queue a redraw on the widget, and then you use the surface as the source for rendering on the cairo_t* that the ::draw signal gives to you.
Do I understand this correctly that what you are saying is as follows? 1) create a surface in the main gtk thread 2) make this surface global across threads 3) draw whatever on the surface 4) bind something to a "draw" signal that redraws _______________________________________________ gtk-app-devel-list mailing list gtk-app-devel-list@gnome.org https://mail.gnome.org/mailman/listinfo/gtk-app-devel-list