This site has been retired. For up to date information, see handbook.gnome.org or gitlab.gnome.org.


[Home] [TitleIndex] [WordIndex

This is a strawman proposal for deprecating the public GtkWidget-based menu API in order to remove it for GTK+ 4.0.

The goal of this strawman is to remove the GtkWidget-based menu API from the public GTK+ API, and allow creating menus through the GMenu XML serialization format, and through the GMenu and GAction API.

Deprecating Menu widgets

GTK+ has three widget classes that manage menus:

All of these are real GtkWidget classes, and handle things like menu hierarchy; input events; positioning; visibility. They allow creating menus by building them piece by piece using the GtkWidget and GtkContainer API, as well as creating new implementations inside application code, and overriding the default behaviour in client-side code.

Over the years we also added API that would take descriptions of the menus and build the actual widgets behind the scenes:

We also pushed for application developers to use the declarative API (and its serialization formats) instead of building menus by hand.

Sadly, all declarative API have different coverage and features:

Prior Art

Most platforms provide an API similar to GMenu: a declarative, descriptive API that defines the menu hierarchy and the attributes of each element, as well as an action to perform on activation.

macOS

Windows

Additional issues

Further application requirements

Review of current GTK api

We have the following GMenu- and GAction-based apis:

Gaps / Shortcomings:

Proposal

This strawman proposal is split into three steps

The deprecation in GTK+ 3.22 is going to be fairly painful for application developers, and we may opt out of it.

Making menu-related GTK+ widgets private is fairly simple build surgery.

The additional GMenu API needs to be identified and discussed with applications making heavy use of menus, and added to the base class inside GIO. Impact on compositors and other platforms needs also further discussion.

Comments


2024-10-23 11:37