I am trying to draw a scatterplot with cairo in gtk3. To start, I am using the examples here: http://zetcode.com/tutorials/cairographicstutorial/
They compile with gtk2 successfully but display no image. They do not compile with gtk3 but give the following error:
example.c: In function ‘on_expose_event’:
example.c:17:31: error: ‘GtkWidget’ has no member named ‘window’
Any help on this would be greatly appreciated.
btw I am using writing using ArchLinux for this if that helps.
There have been quite a few changes in Gtk3. There is no member
windowexposed as part ofGtkWidgetanymore, the members have been moved toGtkWidgetPrivatewhich is an opaque structure so you cannot access the members directly fromGtkWidget. You will have to use accessor function, in this case where you needwindowmember ofGtkWidgetyou can usegtk_widget_get_window, but that may not fix the code sample with which you are working. Please note that theexpose_eventsignal has been replaced withdrawsignal so you will need to update the function which is actually drawing appropriately (on_expose_eventin your case I think). Please refer this link to see the list of changes needed to switch to Gtk3. You can refer source provided bygtk-demoapplication ordemos/gtk-demofrom Gtk3 source code to get sample code.Regarding image not being shown in case of Gtk2, if you are working with image sample, please make sure that the image file is available in the path mentioned in the source.
Hope this helps!