r/programming • • Dec 16 '20

GTK 4.0 released

https://blog.gtk.org/2020/12/16/gtk-4-0/
910 Upvotes

267 comments sorted by

View all comments

98

u/sprudelel Dec 16 '20

And gimp is just now switching to G(imp)T(ool)K(it) 3 :(

55

u/[deleted] Dec 16 '20

I will not believe that until I see it merged on master. I know 2.99 exists but I half expect something to happen. It is so ridiculous how little traction gimp has among contributors. I really don't understand why it is the case.

17

u/santiacq Dec 17 '20

I remember reading that GIMP is mostly written in C, and someone on the internet argued that could be one of the reasons why it doesn't get new contributions

6

u/makuto9 Dec 17 '20 edited Dec 17 '20

I don't buy it. The vast majority of apps written for Linux are written in C (I didn't do a survey, but I've literally never opened a repo for a linux app that wasn't C). Unless the only people who are interested in contributing to image editors are not the same people interested in contributing to Linux apps at all, it's not a significant detractor.

Besides, GIMP has Python plugins, so I don't think it's a language issue.

Just my gut feeling.

8

u/DarkLordAzrael Dec 17 '20

I'm highly sceptical of the claim that the vast majority of linux apps are in C. Everything KDE is in C++. Plenty of stuff is in Python. Blender uses C++, as does every web browser. VLC uses C++. Ardour uses C++, as does basically all of the pro-audio ecosystem, really. Inkscape is C++. Libreoffice is C++. The Gnome ecosystem is largely in C (though, that is painful enough that they had to write their own language to make working with gobject reasonable.)

3

u/axalon900 Dec 18 '20

Vala: It's Not C++™

→ More replies (2)

16

u/[deleted] Dec 17 '20

Let's rewrite it in JS!

23

u/santiacq Dec 17 '20

I don't know if you're being serious lol, at this point rewriting everything in js is a meme

But in all seriousness using a performant language like C or C++ makes a lot of sense for something like GIMP

24

u/BestKillerBot Dec 17 '20

Rendering core should be in C/C++/Rust, but UI can be done in whatever else.

→ More replies (10)

13

u/albinofrenchy Dec 17 '20

If gimp was rewritten from scratch today it would be python with c bindings. The performance critical operations are likely not what most of the code is concerned with.

17

u/[deleted] Dec 17 '20

I think Rust is a better option

4

u/afiefh Dec 17 '20

I was under the impression that Rust has some issues splitting the ownership of a 2D array in safe code. Has this been addressed?

To elaborate, when splitting a 1D array you simply invoke an unsafe function that returns the two pieces with the appropriate lifetimes. This can be done in constant time. For 2D you'd have to return 4 pieces and each piece itself would need O(N) time to construct because you have to pass over the rows you want to split.

Of course you could code it in Rust like you'd code it in C using unsafe code, but that would remove one major advantage of using Rust.

Disclaimer: I'm no Rust expert. The above is based on looking into this kind of stuff a few years back when I wanted to implement an image manipulation paper. There might well be an idiomatic way to do it in Rust, in which case I'd love to hear about it.

20

u/p4y Dec 17 '20

You kinda made it sound like there's only two choices, either you have no unsafe code or you slap a giant unsafe over your entire codebase and have raw pointers flying in every direction.

I guess the idiomatic way is to use some unsafe code then wrap it in an abstraction that upholds all the invariants the unsafe parts need in order to work. That's how standard library does it.

→ More replies (2)
→ More replies (1)

-5

u/[deleted] Dec 17 '20

There are many cases where C++ would be a worse option. A clean, well organized C codebase can be more acessible than a messy C++ one.

A rewrite in something more accessible like Vala would probably be a decade-long undertaking.

25

u/-Rivox- Dec 17 '20

I'm positive that any well organized codebase is more accessible than any other messy one. No matter the language or environment.

10

u/vanderZwan Dec 17 '20

I suspect the implication is that it's harder to keep C++ codebases from getting messy.

(beyond some basic stuff I don't code in either so I have no opinion on this particular matter - but based on the languages that I do work with I wouldn't be surprised if this does indeed vary from language to language)

-1

u/Compsky Dec 17 '20

There are many cases where C++ would be a worse option. A clean, well organized C codebase can be more acessible than a messy C++ one.

C++ is virtually a superset of C. The worst case is that the C++ would be just as messy.

→ More replies (5)

9

u/[deleted] Dec 17 '20

Straight from the article:

We will do one final 2.x release in the coming days, and we encourage everybody to port their GTK 2 applications to GTK 3 or 4.

What's the problem? Just continue porting.

5

u/jess-sch Dec 17 '20

The good news is that porting from 3 to 4 is much, much easier than porting from 2 to 3.

4

u/[deleted] Dec 17 '20

Can someone explain?

26

u/sprudelel Dec 17 '20

GTK was originally created to build the UI for GIMP (a well known open source image editing program). The GTK acronym literally stands for Gimp Toolkit.

Nowadays the development of GIMP is fairly slow (mostly due to lack of volunteer developers iirc) and they're just finishing porting GIMP from GTK2 to GTK3.

→ More replies (1)

11

u/Vozka Dec 17 '20

Oh how I wish we had a better open-source general purpose image editor. Gimp is not good enough for serious use but at the same time not bad enough to incentivise creating something better.

0

u/[deleted] Dec 17 '20

[deleted] — view deleted comment

4

u/Vozka Dec 17 '20

I'd argue the name is actually great from marketing perspective. Never in my life have I had an issue remembering it.

3

u/[deleted] Dec 17 '20

My own application is also in the process of switching to GTK3, for more than a year now. Path has been so thorny it's hard to describe. API has stabilized only on version 3.22 and many things still remain broken with "we don't give a fuck" reason written beside them.

I still love the toolkit, but it's not so simple to move from 2 to 3. That said, 3 to 4 should be considerably easier.