|
|
Log in / Subscribe / Register

GTK 4.0

GTK 4.0

Posted Dec 17, 2020 0:48 UTC (Thu) by atnot (guest, #124910)
In reply to: GTK 4.0 by fman
Parent article: GTK 4.0

Gtk4 is not a major release in the sense that Gtk3 was. Most applications will require very minimal porting, they've learned their lesson.


to post comments

GTK 4.0

Posted Dec 17, 2020 10:06 UTC (Thu) by mchehab (subscriber, #41156) [Link] (2 responses)

> Gtk4 is not a major release in the sense that Gtk3 was. Most applications will require very minimal porting, they've learned their lesson.

I did a port of Camorama from Gtk3 to Gtk3 two years ago, and I tried to keep it ready for Gtk4.

Camorama works by creating a GtkDrawingArea, mapping a callback that would allow filling the pixbuf area from the data retrieved from the camera. It turns that they dropped support for gdk_cairo_surface_create_from_pixbuf(). The git log is short, and just says that "it's unused", without providing any glue about how to replace it:

https://gitlab.gnome.org/GNOME/gtk/commit/7ef8696a7dc2c7a...

I remember I tried hard on that time (Gtk 3.94) to see a replacement for that. I found none. The migration instructions at:

https://developer.gnome.org/gtk4/stable/gtk-migrating-3-t...

Also doesn't help.

GTK 4.0

Posted Dec 17, 2020 11:56 UTC (Thu) by alexl (guest, #19068) [Link] (1 responses)

Why do you need to convert a pixbuf to a cairo surface to draw it? Just call gdk_cairo_set_source_pixbuf() to draw it onto the cairo_t.

Of course, with Gtk 4 you ideally don't want to use cairo to draw at all as it is really the old "fallback" software rendering codepath.

The modern way to draw is to implement snapshot and create render nodes which will avoid any cairo work and just do OpenGL rendering.

However snapshot is kind of lowlevel. Its used if you want to do some custom specialized rendering. If you just want to render an image in your UI, just put the pixbuf in a in a GtkPicture subwindow. One of the nice advantages of Gtk4 is that everything, even sub-parts of widgets are just widgets. You very rarely have to have a custom drawing function that draws multiple things.

GTK 4.0

Posted Dec 17, 2020 12:05 UTC (Thu) by alexl (guest, #19068) [Link]

eh, subwidget, not subwindow

GTK 4.0

Posted Dec 18, 2020 14:33 UTC (Fri) by Vipketsh (guest, #134480) [Link] (1 responses)

If porting requires only "very minimal porting" why didn't they put in some "very minimal" work and make it no effort required ?

I have to wonder why library authors in general don't or can't make their users into at least drive-by-developers of the library ? After all the users of the library are, by definition, also developers. If they could somehow do this then all this "very minimal porting" wouldn't need to be repeated by each user but could instead be pooled into the central library and everyone would benefit. Synergy and all that.

GTK 4.0

Posted Dec 18, 2020 20:05 UTC (Fri) by swilmet (guest, #98424) [Link]

Why users of a library are often not also contributors of that said library? Because developers are busy enough with their own projects. Otherwise everybody would end up being kernel developers or physicians and mathematicians.

As a personal story, after two-three years of developing a GTK LaTeX editor (during my spare time), I started to contribute to the GtkSourceView library. And in a short period of time my focus had completely switched to GtkSourceView, not the LaTeX editor anymore (because lack of time of course).

As a single individual, you cannot at the same time develop a whole application with a lot of features, *and* develop all the libraries that you use. Except if you have a lot of funding or a thriving community of contributors.

Again, to continue my personal story, nowadays I would love to write a new text widget, or to significantly improve GtkTextView. But I know that if I do that, it would become my main project for the foreseeable future, and I don't really have the funding for that.


Copyright © 2026, Eklektix, Inc.
Comments and public postings are copyrighted by their creators.
Linux is a registered trademark of Linus Torvalds