I’ll second this. Gtk is complex, with three layers (gtk, gdk, g). Then there are separate pieces like pango and Cairo. It’s not obvious how it all fits together and a slew of depreciation makes it hard to untangle. What’s needed is a full blooded example. Start from main and show a pure gtk+3 app that takes button press, mouse moves, text entry and keystrokes, and uses them to update labels with different markup options. Throw in a clock display to show timers. Use multiple threads to show how to add idle functions. Use css. It’s easier to grab a generic, fully featured example and cut it down than start with disjoint pieces. But I didn’t find one. > On Jul 26, 2018, at 3:59 AM, Timm Bäder <mail@xxxxxxxxxxx> wrote: > > That pointer is just not used because this is a minimal example that doesn't > even do any custom drawing. If you don't use it, don't declare it. > > The cairo_t gets passed to the draw implementation by GTK+, it's > a parameter to the my_button_draw function. See also the > documentation for gtk_widget_draw(). > > >> On 2018-07-26 10:00, Göran Hasse wrote: >> If you look in the widget_class->draw section >> MyButton *button = MY_BUTTON(widget); >> Why is this pointer to button created? It is not used! >> And where is the cairo_t *cr comming from? >> This is a turorial that is not so easy to understand... >> /gh >>> Den 2018-07-26 kl. 08:39, skrev Timm Bäder: >>>> On 2018-07-26 09:42, Göran Hasse wrote: >>>> Hello! >>>> I try to write a custom widget in Gtk3. I study the source for other >>>> widgets but I find no totorial >>>> for how to write a widget in Gtk3. (There was for Gtk2 - but they are >>>> not of any use anymore...). >>>> Is there no interest in Gtk3 anymore? I find it very hard to find >>>> tutorials for Gtk3. >>> There's https://wiki.gnome.org/HowDoI/CustomWidgets >>> _______________________________________________ >>> gtk-list mailing list >>> gtk-list@xxxxxxxxx >>> https://mail.gnome.org/mailman/listinfo/gtk-list >> -- >> Göran Hasse >> Raditex Control AB >> Boo 229 >> 715 91 ODENSBACKEN >> http://www.rscada.se >> OrgNr: 556611-8773 >> email: gorhas@xxxxxxxxxx >> tel: 019-450105 >> mob: 070-5530148 >> Lat: 59.18805083 Long: 15.50300449 >> URL: http://alturl.com/3e6hf >> _______________________________________________ >> gtk-list mailing list >> gtk-list@xxxxxxxxx >> https://mail.gnome.org/mailman/listinfo/gtk-list > _______________________________________________ > gtk-list mailing list > gtk-list@xxxxxxxxx > https://mail.gnome.org/mailman/listinfo/gtk-list _______________________________________________ gtk-list mailing list gtk-list@xxxxxxxxx https://mail.gnome.org/mailman/listinfo/gtk-list