Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GTK3 support #23

Closed
vanillajonathan opened this issue Mar 7, 2017 · 24 comments
Closed

GTK3 support #23

vanillajonathan opened this issue Mar 7, 2017 · 24 comments

Comments

@vanillajonathan
Copy link

Add support for the GTK 3 toolkit.

@wjaguar
Copy link
Owner

wjaguar commented Mar 9, 2017

The code reorganization is done, adding a GTK3 backend to vcode.c is now largely trivial. But I'm myself at the moment busy with real life, so if no one else contributes the code, the implementation will have to wait till better times. :(

@JotaRandom
Copy link

I was reading GNOME docs related to GTK4+ and for GTK3 3.22 (or 3.26 depending on the source and page) is a "LTS" where 4.0 (and again or 4.6) is supposedly the next major target, yet initially GTK4 is scheduled for 2019-2020 and then 2 years for every new major GTK+ version so unless you think you can have GTK3 sorted before 2019-2020 better target GTK3.99 for GTK4 (like what GIMP look like will ended doing).

@wdlkmpx
Copy link

wdlkmpx commented Feb 11, 2020

For GTK3 support to happen all the GTK1 code must be removed, all GTK2 deprecations should be replaced with pure GTK2 alternatives.

The projects supporting GTK1 are basically unportable to GTK3, because many GTK1 widgets no longer exist.. the codebase would be a complete mess.

Even porting a project to pure GTK2 without deprecations is something really incredibly difficult.

The path to GTK3 can be really long and painful and GTK3 support may never happen.. the gFTP project's GTKUI has been mostly rewritten and still cannot be ported to GTK3.. mhWaveEdit's fork 'gWaveEdit' might never achieve GTK3 support.

If GTK3 support is to be added, I'd suggest port everything to GTK 2.24 (the minimum supported version) before any attempt to add gtk3 support is made.

@wjaguar
Copy link
Owner

wjaguar commented Feb 11, 2020

As to what need be done, you are exactly right.
As to what was done to let GTK+3 neatly coexist with GTK+1 and GTK+2 as a third option despite all that, it is the V-code engine (vcode.c)

The 3.49.xx branch does not refer to any "GTK1 widgets", or any GTK+ widgets whatsoever for that matter, anywhere outside vcode.c and its supporting mygtk.c ; the "V-code widgets" it uses instead, are abstract enough to work in console mode being driven by script statements.
IOW, there is no place left for any mess, much less a "complete" one, to develop; any newly-missing widget just has to be very superficially simulated in exactly one single place. The only reason this hasn't been done years ago as per initial plan, is that real life intruded; and with no one else working on the code, things ground to a complete halt for some periods.

@wdlkmpx
Copy link

wdlkmpx commented Feb 11, 2020 via email

@wjaguar
Copy link
Owner

wjaguar commented Feb 11, 2020

Using own brain to think is the first step. This isn't D&D, repeating magic words doesn't change reality.

For "reimplementing everything", you have to be using everything. No one ever does. And if you think about it, a program driving any widget wants only a very few fairly abstract things of it; display some value in, get new value out, maybe also modify the representation, and/or subscribe to notices of some type of changes. What exactly is happening there under the hood when it does, is an irrelevant technicality.
A totally different widget, or several, or no widget at all, giving sensible reactions to those very few requests, is a perfect drop-in replacement as far as everything outside vcode.c is concerned. As is exemplified by mtPaint happily running in commandline mode with all its "GUI code" doing its job without seeing any difference.

When deprecations count not against uses of widgets but types of them, they are not a problem. It is the differences in handling non deprecated ones which need be compensated for, that are tedious; as in having to review all the 1200+ calls to GTK+ to see if the function got replaced by a differently named one.

And if vcode.c gets a few more #ifdef's and #define's than now, so what?

@wdlkmpx
Copy link

wdlkmpx commented Feb 11, 2020 via email

@wjaguar
Copy link
Owner

wjaguar commented Feb 12, 2020

Naturally it won't be hard; tedious, surely. Lines to add I estimate at 1000, tops (it's quite improbable the few parts-to-reimplement could grow in size 7x, now isn't it?); it is the lines to review that are boooring. :)

As to the rest of your verbiage, I'm unsure whether you've come here to whine, or boast; in case it's the latter, please point me to your reason for it.

@wdlkmpx
Copy link

wdlkmpx commented Feb 12, 2020 via email

@wdlkmpx
Copy link

wdlkmpx commented Feb 12, 2020 via email

@wjaguar
Copy link
Owner

wjaguar commented Feb 12, 2020

To do anything with any GTK+ reliably, people "must be gtk gurus", for the sad reason that the thing is buggy, in different ways in different versions. In mtPaint I do quite a few conditional workarounds for various things.
To make things in GTK+1 work not much worse than in GTK+2, it is double that; one has to read both codebases, and sometime add sizable chunks for something which in GTK+1 just is not there. #ifdef'ing them out in GTK+2 where the same can be done natively in a few lines.

After dealing with that, GTK+3 is just more of the same.

@wdlkmpx
Copy link

wdlkmpx commented Feb 12, 2020 via email

@wjaguar
Copy link
Owner

wjaguar commented Feb 12, 2020

The core problem has not changed any in those 15 years. GTK+ itself is adding more and more cruft year in and year out, with hw struggling to catch up. People who still use GTK+1, usually do it for the reason of some kind of weak device. The niche of image editor for such devices is mtPaint's and always was.

Understanding all supported versions is a must for equalizing behaviour on them, yes, but it is always a work in progress; some corner cases may lurk for years and years in depths of UI before getting noticed. :)

As I see it, people trying to "update" GTK+1&2 projects mostly do it from a misplaced belief that "newer == better"; the maxim "If it ain't broke, don't fix it" need be studied diligently and meditated upon. :)
One valid reason is to do it as a technical challenge, but any loss of functionality (including compatibility) is a failure then.

@wdlkmpx
Copy link

wdlkmpx commented Feb 13, 2020 via email

@wdlkmpx
Copy link

wdlkmpx commented Feb 13, 2020 via email

@wjaguar
Copy link
Owner

wjaguar commented Feb 13, 2020

Actually mtPaint's baseline is GTK+ 2.4 (what the first version was developed on) with some features newer than that taken advantage of if not forbidden at compile time; GTK+ 1.2 is supported as far as technically possible, and that's it.
The use of GtkList and GtkCList instead of GtkTreeView has three causes; first, despite all their bugs, the first two were at least left alone ("deprecated", see) while churn in GtkTreeView went on and on and on. Bugs you know, you can work around once and forget about; bugs randomly thrown at you, not. Second, GtkTreeView was really dog slow for large lists (such as in file selector sometimes). And third, it is not a container so has no settable border. :) Which deficiency may not seem like much, but is a very nasty thing to work around; as the widget is scrollable, and cannot integrate with GtkScrolledWindow through a container. (Now investigating what the easiest workaround would be for GTK+3.)
P.S.: Workaround is 23 lines but required some digging to find what in the manual works for real. As usual.

@wdlkmpx
Copy link

wdlkmpx commented Feb 13, 2020 via email

@wdlkmpx
Copy link

wdlkmpx commented Feb 14, 2020 via email

@wdlkmpx
Copy link

wdlkmpx commented Feb 14, 2020 via email

@wjaguar
Copy link
Owner

wjaguar commented Feb 14, 2020

As one sleepy brown bear once said:
"If ye find that the Bullock can toss you, or the heavy-browed Sambhur can gore;
Ye need not stop work to inform us; we knew it ten seasons before."

@wdlkmpx
Copy link

wdlkmpx commented Feb 14, 2020 via email

@wjaguar
Copy link
Owner

wjaguar commented Feb 14, 2020

Once again, you need to understand the concept of separation between application logic and UI representation. If a developer mixed the two up, then yea, throw a different widget toolkit at him and watch the descent to madness. :) But when the two neither know nor care about each other's specifics, either side can be changed with total ease.
This is why V-code reigns supreme here. :)

@wjaguar
Copy link
Owner

wjaguar commented Feb 15, 2020

Rememberest thou well this my wisdom; it is not the variations in names thou needst fear, nor widget replacements. It is undocumented changes under the hood.
Behold and admire: https://mail.gnome.org/archives/gtk-devel-list/2013-May/msg00011.html
Note that GtkPixelCache is NOT exported by GTK+3; to work around the issue, you have to roll your own.
The two-paragraph sidenote "Scrolling" lurking in "The GTK+ Drawing Model" can serve for a vocabulary definition of "glossing over".

@wjaguar
Copy link
Owner

wjaguar commented Mar 18, 2020

Option added in 3.49.25 - "./configure gtk3"

@wjaguar wjaguar closed this as completed Mar 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants