1. GTK4

Here are some screenshots of the progress on EuGTK4.

https://photos.app.goo.gl/uvBdkS4ZENgaTWQR7

Note the simplicity of the code needed to "wrap" each Gtk "widget". Example:

 
----------------------- 
namespace PasswordEntry 
----------------------- 
include gtk4.e 
 
constant self = PasswordEntry 
 
widget[self] = {"gtk_password_entry_", 
 
 {Widget}, -- ancestor 
  
 {"new",{},P}, -- constructor 
  
 {"get_extra_menu",{P},P}, -- instance methods 
 {"get_show_peek_icon",{P},B}, 
 {"set_extra_menu",{P,P}}, 
 {"set_show_peek_icon",{P,B}}, 
  
 "PasswordEntry"} 
  
 export function new() 
    atom fn = define_c_func(LIB,"gtk_password_entry_new",{},P) 
    atom handle = c_func(fn, {}) 
    return register(init(self), handle) 
 end function 

Each "widget" is implememted with a file like this, except most have a longer list of methods. The main file which handles the widgets is currently about 600 lines.

new topic     » topic index » view message » categorize

2. Re: GTK4

irv said...

Here are some screenshots of the progress on EuGTK4.

That's awesome, irv! Glad to see you working on this project!

new topic     » goto parent     » topic index » view message » categorize

3. Re: GTK4

irv said...

Each "widget" is implememted with a file like this, except most have a longer list of methods.

Currently MAX_FILE is set to 256, after which you get "program includes too many files." Similarly, INCLUDE_LIMIT is set to 30, which produces "includes are nested too deeply."

I was considering bumping these up (to 4096 and 256) for the release of 4.2, as they're only checked one per include file during IncludePush(), so it's probably safe to change.

-Greg

new topic     » goto parent     » topic index » view message » categorize

4. Re: GTK4

I doubt I'll run into those limits, there are only ~200 files, and most programs will only use a subset.

Interestingly, a small program that runs interpreted uses 26MB of memory, while the same one compiled uses 98MB.

But the good thing is that they compile and run with Eu 4.2.0 devel.

new topic     » goto parent     » topic index » view message » categorize

5. Re: GTK4

Pretty neat looking. Is it cross-platform? Will it run under Windows?

new topic     » goto parent     » topic index » view message » categorize

6. Re: GTK4

Icy_Viking said...

Pretty neat looking. Is it cross-platform? Will it run under Windows?

Looks like it could be made to do that. But not by me.

I have an allergy to Windows.

Someone could probably do it fairly easily, because the widgets and properties/methods would be the same, those files wouldn't have to be modifed. Just the loading of libraries and such, which is handled by one main file (~600 lines).

Once I get it all working, anyone can volunteer to make the changes.

new topic     » goto parent     » topic index » view message » categorize

7. Re: GTK4

irv said...
Icy_Viking said...

Pretty neat looking. Is it cross-platform? Will it run under Windows?

Looks like it could be made to do that. But not by me.

I have an allergy to Windows.

Someone could probably do it fairly easily, because the widgets and properties/methods would be the same, those files wouldn't have to be modifed. Just the loading of libraries and such, which is handled by one main file (~600 lines).

Once I get it all working, anyone can volunteer to make the changes.

Windows isn't that bad, lol. Well maybe once you release the source code for your wrapper, I can take a look and see if how feasible it'd be to port to Windows.

new topic     » goto parent     » topic index » view message » categorize

8. Re: GTK4

irv said...

I doubt I'll run into those limits, there are only ~200 files, and most programs will only use a subset.

Your wrapper might not hit those limits alone, but anyone developing a large application could hypothetically include another 50+ files. The standard library itself is over 50 files.

irv said...

Interestingly, a small program that runs interpreted uses 26MB of memory, while the same one compiled uses 98MB.

I'm not surprised. I have some suspicions that the translator is a bit too eager when it comes to global variables and memory allocation. I'll dig into it at some point.

irv said...

But the good thing is that they compile and run with Eu 4.2.0 devel.

That's reassuring. Although I shouldn't be surprised since I've got build.mak making a temporary build of 4.2 that it then uses to build everything else.

-Greg

new topic     » goto parent     » topic index » view message » categorize

9. Re: GTK4

Well - after further consideration, I find that the GTK4 developers have (on purpose) removed lots of functionality, claiming that they are doing so in order to follow the Gnome human interface guidelines.

Which, if you boil them down into a few words, mean "look like a phone".

This is neither attractive looking nor useful for desktop programs.

Looking at programs (what few there are) written with GTK4, all I see are bland, user unfriendly stuff. Compare some for yourself - Gnome music vs most any music player, or Gnome text editor vs almost any other text editor, or Loupe vs most any image viewer. Simplistic, not user-friendly, and ugly.

The above is my personal opinion, but chatgpt agrees:

"That's a very fair and technically accurate take - GTK4 dropped or changed a lot (e.g., no built-in tree views, deprecated containers, reworked rendering pipeline), making it more powerful but also more work for basic UIs. For many apps, you end up re-implementing widgets you used to get for free in GTK3."

I can fix the plain appearance by using css. The sample screenshots I posted above all look crappy without lots of css. But I see no point in trying to write replacements for the useful widgets they have removed or disabled. So this goes on the shelf for now.

Maybe they'll respond to all the criticism online.

new topic     » goto parent     » topic index » view message » categorize

10. Re: GTK4

irv said...

Well - after further consideration... this goes on the shelf for now.

Wow, that's too bad. I hate when devs make... interesting... code and design choices. It's like they don't know their target audience.

There are other kits, though, right? wxWidgets? I wonder if that's still a possibility.

new topic     » goto parent     » topic index » view message » categorize

11. Re: GTK4

Here's the tail end of my (mostly pre-existing) rant about GTK4, not that it is likely to help except perhaps to know that you're not alone:

They have got rid of gtk_main() and gtk_init() to be certain that nothing whatsoever works until after the "activate" event has triggered. You cannot even do this:

 constant {sx,sy} = gGetGlobal("SCREENSIZE") 

So any initial window dependent on that absolutely must be drawn the wrong size, before you can figure out how big you want it, then redrawn the correct size - what's not to like about that?

Mind you, as Phix regularly proves, the presence of any global or static variable/constant will instantly make a program completely unmaintainable. (Sorry, did I miss out a rather emphatic not somewhere in that statement?)

Should you want my opinion, GTK2 got it right and almost does all you might ever need, GTK3 was created because the team felt they were not foisting their opinions of how an application should look and feel on the world forcibly enough [mind you, whatever they did that makes gDrawPolygon 250* faster on GTK3 than it is on GTK2 can only be applauded], and GTK4 was created because they weren't foisting their opinions of how an application should be internally structured and written on the world forcibly enough. [PS: should you be thinking GTK2 has a dated look, that can be overcome.]

The only, and I mean only, possible use of a GtkApplication I could think of is in GTK4_demo so it could use the same instance of GTK4 running multiple "whole source" demos that can start and shutdown independently of each other - which of course is a very specific source management issue, an absolutely miniscule gain over multiple processes, except perhaps for disguising just how long GTK4 takes to fire itself up, the downside of no way to kill a specific one, and no possible justification whatsoever for being imposed on everyone else worldwide.

Coding/porting nightmares aside, in "Q:Does a GtkApplication have x? A:No" I struggle to find anything at all that I can put in place of x that changes the answer. Even "annoyances", "limitations", "disadvantages" don't really fit since it is as a concept so utterly banal and completely meaningless - of course I'm still rather vexed, but talking here about thinking calmly and objectively about the thing itself. Maybe "pointlessness". </rant>

Incidentally, since the IUP sources do not contain "gtk_application_new", I am pretty certain no attempt whatsoever has been made to get that to work on GTK4, and I've not noticed anyone on the IUP mailing list clamouring for it.

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu