Enhancement: GTK4 support (Issue #23415)

192 views
Skip to first unread message

Hamish Mcintyre-Bhatty

unread,
Apr 2, 2023, 8:52:54 AM4/2/23
to wx-...@googlegroups.com, Subscribed

Description

It would be good if GTK4 could be supported in future. I know this is a big endeavour and may not happen anytime soon, but I thought I might as well file an issue for it for tracking.


Reply to this email directly, view it on GitHub, or unsubscribe.
You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415@github.com>

Ian McInerney

unread,
Apr 2, 2023, 7:45:19 PM4/2/23
to wx-...@googlegroups.com, Subscribed

I don't think a general issue like this is useful for development (and that was also said in #22609). IMO, it would make sense to open issues based on specific parts of the code that must be changed/modernized to support GTK4. If they can be done with the GTK3 API as well, then that is nice and contained to test, and doesn't require fixing the entire library.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/1493470322@github.com>

Hamish Mcintyre-Bhatty

unread,
Apr 3, 2023, 6:00:42 AM4/3/23
to wx-...@googlegroups.com, Subscribed

Fair enough, my apologies, happy to close if you like.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/1494031453@github.com>

VZ

unread,
Apr 3, 2023, 7:54:36 PM4/3/23
to wx-...@googlegroups.com, Subscribed

We can keep it open and try to at least collect the list of things that need to be done for GTK 4 support here. But the main problem is that I really have no idea who will have both the competence, time and motivation to work on this. Any help would, of course, be very welcome.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/1495138826@github.com>

Hamish Mcintyre-Bhatty

unread,
Apr 4, 2023, 11:30:57 AM4/4/23
to wx-...@googlegroups.com, Subscribed

I don't know any GTK so I'm unlikely to be much help, unfortunately.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/1496187074@github.com>

MetalPlateMage

unread,
Apr 6, 2023, 3:13:03 PM4/6/23
to wx-...@googlegroups.com, Subscribed

I'm familiar with it. Not sure how it applies to wxWidgets, but the main things that will take some work are:

  • Removal of GtkToolbar. You'll see this a lot as the gnome devs believe stuff like this are outdated "nonsense". Technically there's the toolbar class but..
  • Menus were redone as they were seen as "X11 wrappers" and moved over to the popup model. It's sort of a paradigm shift and I'm not really sure how you'd adjust it to the wx model where menus are derived from each other. Maybe it is easier than I'm making it to be
  • Removal of abstract interfaces like GtkBin and GtkContainer. I'm assuming this means you'd just have implement more derived virtual functions to handle each specific control
  • The other major thing is there is a lot of stuff that is technically still available but heavily depreciated


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/1499503679@github.com>

Avery King

unread,
Aug 9, 2023, 7:44:28 PM8/9/23
to wx-...@googlegroups.com, Subscribed

Hello! I've learned that most of the current GTK port would need to be rewritten in order to support GTK 4 from here. To me this is unfortunate news, but I have an idea: what if we made a separate port for GTK 4? Maybe wxGTK4? (The name sounds a little confusing but we can discuss that later). If a lot of effort is required for the existing GTK port to work with GTK 4, then I suggest maybe creating a new port.

I know that substantial work is required towards creating a new port and that there might not be enough resources to do even that. However, I am highly interested in making a new port for wxWidgets, so I'd like to discuss how we would get to work with this port. Another reason for discussion is so that I can avoid wasting time on something that might not get merged in the end.

Miscellaneous Motivational Paragraph Writing an entirely new port from scratch is not an easy task. I have never contributed to wxWidgets before nor have I worked with GTK at all. However, I believe I am capable of quickly learning both wxWidgets' internals and GTK 4. When I first started Saucedacity (now modern-day Tenacity), I knew not a single thing about Audacity's internals or wxWidgets, but I was able to quickly learn through the codebase and now have a better understanding of the codebase in general.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/1672325313@github.com>

VZ

unread,
Aug 15, 2023, 5:38:41 PM8/15/23
to wx-...@googlegroups.com, Subscribed

@generic-pers0n Whether it's better to create a new port or continue adding GTK 4-specific parts to the existing files isn't totally clear, but, in doubt, I'd rather keep the current approach as, after all, it worked relatively well for GTK 2 and 3, which also differ a lot.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/1679652602@github.com>

Jonathan

unread,
Jan 3, 2024, 9:01:57 PM1/3/24
to wx-...@googlegroups.com, Subscribed

Migrating from GTK 3 to GTK 4 is less painful than the migration from GTK 2 to GTK 3 was.

See the GTK migration guide at https://docs.gtk.org/gtk4/migrating-3to4.html, it covers what changes can be done in GTK 3 in preparation for GTK 4.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/1876207908@github.com>

VZ

unread,
Jan 3, 2024, 9:10:50 PM1/3/24
to wx-...@googlegroups.com, Subscribed

Last time I looked there were parts of wx API that simply could not be implemented in GTK 4 at all, so this is definitely not going to be very simple. But, again, any help is wholeheartedly welcome, including any incremental improvements.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/1876213679@github.com>

paulcor

unread,
Jan 3, 2024, 11:48:28 PM1/3/24
to wx-...@googlegroups.com, Subscribed

Migrating from GTK 3 to GTK 4 is less painful than the migration from GTK 2 to GTK 3 was

Hrm. For wxWidgets, I think not so much. Perusing that rather extensive list (it's been a while), it's one kick to the crotch after another.

"Stop using grabs"
oof...

"Adapt to GtkWindow API changes"
some of it is gone, and it's been renamed to GdkSurface, so probably
oof...

"Adapt to GtkContainer removal"
sigh...

"Adapt to GtkStyleContext API changes"
i.e. much of it is gone, as is GtkWidgetPath entirely, so wxRenderer and wxSystemSettings are wrecked, so that's another oof...

"The ::size-allocate signal has been removed"
oof...

"Adapt to drawing model changes. This area has seen the most radical changes in the transition from GTK 3 to GTK 4."
uh huh...

"GtkWidget event signals are removed"
oof...

"Stop using GtkWidget::draw"
oof...

"GtkMenu, GtkMenuBar and GtkMenuItem are gone"
oof...

"GtkToolbar has been removed"
oof...


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/1876307086@github.com>

Paul Kahler

unread,
Feb 17, 2025, 2:18:00 PMFeb 17
to wx-...@googlegroups.com, Subscribed

For another software project, I made a checklist for the recommended changes that can be made while still using GTK3. Most of those are reasonable, but what angered me most was that I went all the trouble for "Stop using direct access to GdkEvent structs" by using accessor functions, and then for GTK4 a bunch of those functions changed name or were missing. Between that and the menu stuff changing and me not being adept at GTK of any version I gave up. It is still something I consider important, but the effort is non-trivial and impossible to do incrementally unless you can disable large portions of your app while porting one piece at a time. And we don't even use widgets....


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/2663921060@github.com>

phkahlerphkahler left a comment (wxWidgets/wxWidgets#23415)

For another software project, I made a checklist for the recommended changes that can be made while still using GTK3. Most of those are reasonable, but what angered me most was that I went all the trouble for "Stop using direct access to GdkEvent structs" by using accessor functions, and then for GTK4 a bunch of those functions changed name or were missing. Between that and the menu stuff changing and me not being adept at GTK of any version I gave up. It is still something I consider important, but the effort is non-trivial and impossible to do incrementally unless you can disable large portions of your app while porting one piece at a time. And we don't even use widgets....


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/2663921060@github.com>

Ginger Old

unread,
Apr 3, 2025, 10:09:40 AMApr 3
to wx-...@googlegroups.com, Subscribed

gtk4 is now the default in new distro, hope wxWidgets can support it soon.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/2775922131@github.com>

laoshawlaoshaw left a comment (wxWidgets/wxWidgets#23415)

gtk4 is now the default in new distro, hope wxWidgets can support it soon.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/2775922131@github.com>

VZ

unread,
Apr 3, 2025, 10:13:02 AMApr 3
to wx-...@googlegroups.com, Subscribed

Please don't leave comments about hoping that something happens. We all know that GTK 4 is the current GTK version, but this is not enough to somehow make wxWidgets work with it.

If you can work on it, please help making it happen.

If you can fund the work on it, we can discuss it too.

But just hoping doesn't help, unfortunately.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/2775931902@github.com>

vadzvadz left a comment (wxWidgets/wxWidgets#23415)

Please don't leave comments about hoping that something happens. We all know that GTK 4 is the current GTK version, but this is not enough to somehow make wxWidgets work with it.

If you can work on it, please help making it happen.

If you can fund the work on it, we can discuss it too.

But just hoping doesn't help, unfortunately.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/2775931902@github.com>

Avery King

unread,
Aug 30, 2025, 6:09:57 PMAug 30
to wx-...@googlegroups.com, Subscribed
generic-pers0n left a comment (wxWidgets/wxWidgets#23415)

For another software project, I made a checklist for the recommended changes that can be made while still using GTK3. Most of those are reasonable, but what angered me most was that I went all the trouble for "Stop using direct access to GdkEvent structs" by using accessor functions, and then for GTK4 a bunch of those functions changed name or were missing. Between that and the menu stuff changing and me not being adept at GTK of any version I gave up. It is still something I consider important, but the effort is non-trivial and impossible to do incrementally unless you can disable large portions of your app while porting one piece at a time. And we don't even use widgets....

Before I say anything, I need to disclaim that I'm also not very adept at GTK, so I'm going to try my best to figure it out.

With that disclaimer out of the way, I think it's a good idea to start with refactoring the current GTK 3 implementation. Maybe from then we can experiment with a GTK 4 implementation once we're no longer using deprecated GTK 3 features. I'll see if I can experiment with modifying the current GTK 3 implementation to avoid usage of deprecated features.

Finally, I have a semi-relevant question: assuming we were to start a new port for whatever reason, what's anyone's thoughts on gtkmm? It looks like it'd be more appropriate to use considering wxWidgets is written in C++, but anyways...


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/3239574828@github.com>

VZ

unread,
Aug 30, 2025, 6:29:18 PMAug 30
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#23415)

Sorry, but I have serious doubts that laying 2 libraries abstracting GTK on top of each other is going to be useful, I suspect we'd spent time fighting with not just GTK but gtkmm too then. And it would be nice to avoid rewriting all wxGTK code, even if it seems like we'll have to rewrite quite a chunk of it anyhow :-(


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/3239581999@github.com>

Avery King

unread,
Aug 30, 2025, 6:39:27 PMAug 30
to wx-...@googlegroups.com, Subscribed
generic-pers0n left a comment (wxWidgets/wxWidgets#23415)

Sorry, but I have serious doubts that laying 2 libraries abstracting GTK on top of each other is going to be useful, I suspect we'd spent time fighting with not just GTK but gtkmm too then.

Yeah, no, you're definite right about that 😅

I think I had the thought in mind that we could continue with a rewritten GTK port using gtkmm instead of regular GTK.

And it would be nice to avoid rewriting all wxGTK code, even if it seems like we'll have to rewrite quite a chunk of it anyhow :-(

True, and at least my previous statement regarding gtkmm was mainly a thought. I still haven't made a deep dive into this entire task yet, but I'm looking into it further right now.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/3239585639@github.com>

Titus von Boxberg

unread,
Oct 9, 2025, 3:14:55 AM (8 days ago) Oct 9
to wx-...@googlegroups.com, Subscribed
tvb377 left a comment (wxWidgets/wxWidgets#23415)

If you can fund the work on it, we can discuss it too.

I would be willing to contribute financially.

My experience using Linux on the Desktop is rather limited, and using GTK is zero. Thanks, wxWidgets!
Based on this limited experience, I think the GTK4 project is a matter of life or (not too) slow death and should be the topmost priority for wxWidgets.

I cannot see a fundraising infrastructure for wxWidgets.
Setting up the infrastructure might be a first step, followed by a campaign.
But I am unable to determine from the home page if the project is in or could be brought into a state in which throwing money at it would help.
And, obviously, I don't know if a fund raising campaign would work, but I'm quite convinced that enough people would donate to this project.


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/3384446281@github.com>

Alex Crawford

unread,
Oct 9, 2025, 3:26:48 AM (8 days ago) Oct 9
to wx-...@googlegroups.com, Subscribed
crawford left a comment (wxWidgets/wxWidgets#23415)

I'm quite convinced that enough people would donate to this project

+1


Reply to this email directly, view it on GitHub, or unsubscribe.

You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/3384515043@github.com>

VZ

unread,
Oct 9, 2025, 1:28:31 PM (8 days ago) Oct 9
to wx-...@googlegroups.com, Subscribed
vadz left a comment (wxWidgets/wxWidgets#23415)

> I cannot see a fundraising infrastructure for wxWidgets.

We don't have one. We do have people who provide (paid) consultancy/development services for wxWidgets — [me](https://www.tt-solutions.com/), for one, and Stefan AFAIK.

The problem with GTK 4 port is that it's clearly going to be

1. A lot of work.
2. Difficult to estimate the amount/difficulty of this work before doing it.

which is not a great combination from the point of view of project planning.

I do agree that we need to do it and that we won't be able to stay at GTK 3 forever, even if I don't see any big problems with doing it just yet..

Titus von Boxberg

unread,
Oct 9, 2025, 2:11:18 PM (8 days ago) Oct 9
to wx-...@googlegroups.com, Subscribed
tvb377 left a comment (wxWidgets/wxWidgets#23415)

I cannot see a fundraising infrastructure for wxWidgets.
We don't have one.

That's a relieving and good reason why I can't see one.

The problem with GTK 4 port is that it's clearly going to be

  1. A lot of work.
  1. Difficult to estimate the amount/difficulty of this work before doing it.

    Yeah, but that's only a summary of this thread.

    I do agree that we need to do it and that we won't be able to stay at GTK 3 forever, even if I don't see any big problems with doing it just yet...

    Yes. but with respect to GTK4, apparently there is no we since over 2 years.
    You wrote in April that funding would be an option, and I offered to pay, but considering your point 1 I asked if it would be worthwile considering a fundraising campaign?

    Regarding your summary point 2:
    Do you know any GTK4 wizards who could be asked for (payed) help, even if only by giving a better educated guess about the amount of work?
    That would also be a first step to get an overview.

    Regarding big problems: The more work is done in the shiny new Linux GUI directions, the sooner GTK3 will fall off the cliff, rendering wxWidgets useless. Just as an example, currently it's annoying for me that SetPosition appears to do nothing under wayland. Probably the example is bad; I don't know if "just" using GTK4 would be the fix, but it's an example for the direction we're heading with wx.


    Reply to this email directly, view it on GitHub, or unsubscribe.

    You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/3386995821@github.com>

    VZ

    unread,
    Oct 9, 2025, 5:03:48 PM (7 days ago) Oct 9
    to wx-...@googlegroups.com, Subscribed
    vadz left a comment (wxWidgets/wxWidgets#23415)

    Yes. but with respect to GTK4, apparently there is no we since over 2 years. You wrote in April that funding would be an option, and I offered to pay, but considering your point 1 I asked if it would be worthwile considering a fundraising campaign?

    Maybe I'm wrong, but I don't think a crowdfunding campaign can collect enough funds to pay for this work. It will either be someone (possibly even me, although right now this doesn't seem very likely) doing it on their own time or some company with sufficient resources either doing it themselves or paying somebody to do it.

    Regarding your summary point 2: Do you know any GTK4 wizards who could be asked for (payed) help, even if only by giving a better educated guess about the amount of work? That would also be a first step to get an overview.

    Unfortunately I think knowledge of wx may be at least as important here as knowledge of GTK 4 because wxGTK uses GTK in not very standard ways, to put it politely. But, of course, you still need to know GTK 4. And, worse, this work can't be done outside of the project because it will almost certainly (99% likely) require changes to wx API to replace parts of it which just can't be implemented with GTK 4 because it intentionally doesn't support some things with something else that can be done with it.

    Regarding big problems: The more work is done in the shiny new Linux GUI directions, the sooner GTK3 will fall off the cliff, rendering wxWidgets useless. Just as an example, currently it's annoying for me that SetPosition appears to do nothing under wayland. Probably the example is bad

    Yes, it really is because this is a(n intentional) Wayland limitation and no version of GTK or any other toolkit will help with this. But there are certainly other good reasons to use GTK 4.


    Reply to this email directly, view it on GitHub, or unsubscribe.

    You are receiving this because you are subscribed to this thread.Message ID: <wxWidgets/wxWidgets/issues/23415/3387481877@github.com>

    Reply all
    Reply to author
    Forward
    0 new messages