Previous Post | Top | Next Post |
TOC
Note on recent change of environment for GUI design
Since the computer monitor screen has changed fro VGA (4:3) to HDTV (16:9), screen got wider. In other word, we have relatively less vertical space for the computer monitor screen.
Now cellphones and tablets are powerful enough to use previously Desktop only general purpose programs. Go the GUI need to handle touch events.
Lastly, X11 is not the only GUI target. Wayland and browser needs to be addressed.
These things are driving changes in design of the low level GUI support tools such as GTK.
Recent GTK changes
Quite frankly, it was very confusing for me since GTK was a moving target. We are moving even to GTK4 now after August/2021 for Debian. (I mean post-Bulleseye release.) Here is my memo.
Here are list of information I gathered to solve “Titlebar” and “Primary menu” questions. I also posted comments based on my understanding.
- Can’t add GtkHeaderBar to “Client side window decoration” area
- Can’t add GtkHeaderBar to window with existing widgets / containers
- PyGObject-Tutorial: issue/127: Menus, Actions
It looks to me there have been an effort to save vertical space. I can summarize the originally intended design practice of each platform as:
- GNOME2/GTK2 – Classic character based pull down menu at the top of the application’s window
- GNOME3/GTK3 – Display application’s menu as a popover from the system menu at the top of the monitor screen
- GNOME4/GTK4– Display application’s menu as a popover from the top titlebar of the application’s window
As usual of these platform transition, the last release of each generation of platform supports platform of the next generation while deprecating the practice it used to support. Debian Bullseye as of 2021 is based on the last release of GNOME3/GTK3 in late 2020 and its design principle has moved almost to GNOME4/GTK4 ones. Namely, it recommend to use primary menu started from the titlebar created with Client-side decoration (CSD).
Menu on recent GTK3 and Client-side decoration (CSD)
Topics related to “Client-side decoration” and menu of GNOME/Gtk in historical context. (events and some blogs from older ones to newer ones in the order):
- Gtk.menu has been used from early GNOME 2
- GNOME 2.32 release (2010-09) – Gio.Menu introduced
- Open Letter: The issues with client-side-window-decorations (2010) (KDE POV on CSD)
- GNOME 3.0 release (2011-04)
- Client Side Window Decorations and Wayland (2013) (KDE POV on CSD)
- GNOME 3.10 release (2013-09) – Wayland support and introduction of header bar widget
- Some Gtk.Action, Gtk.menu functions deprecated –> Gio.menu, Gio.Action
- The Python GTK+ 3 Tutorial (as of 2021-07) goes as: Gtk.UIManager, Gtk.Action, and Gtk.ActionGroup have been deprecated since GTK+ version 3.10.
- Some Gtk.Action, Gtk.menu functions deprecated –> Gio.menu, Gio.Action
- CLIENT-SIDE DECORATIONS IN THEMES (2013, mclarsen)
- CLIENT-SIDE DECORATIONS, CONTINUED (2014, mclarsen)
- A small note on window decorations (2015, Florian Müllner)
- Introducing the CSD Initiative (2018)
- Farewell, application menus! (2018)
- GNOME 3.38 (2020-09) – Final GTK3-series based major release
- Wikipedia: Client-side decoration (meaningful last update 2020-11)
- Archlinux GTK: Hide_CSD_buttons …
- Archlinux BBS: Views on Client Side Decorations (CSD) (2021-03)
- Gnome: Header bars (valid for 2021)
- Primary menus – humburger menu for both the current window or view, as well as the application as a whole (usually on the left side of application top bar)
- Use: GtkMenuButton, GtkPopoverMenu
- Secondary menus – 3-dots menu for the current view or content item (usually on the left side of application top bar)
- Use: GtkMenuButton, GtkPopoverMenu
- Header bars are incompatible with menu bars.
- Primary menus – humburger menu for both the current window or view, as well as the application as a whole (usually on the left side of application top bar)
- Application menu – Deprecated (as of 2021) (shown at the screen top menubar)
- Use GtkApplication
- Each item in your application menu must already be exposed as a GAction
- See GAction HowDoI/GAction.
- GtkApplication with a simple GMenu and SimpleActions
- Use GTK2-style “menu bar menus” instead as workaround if Gnome: Header bar doesn’t work.
- Use GtkApplication
GTK3 to GTK4 migration.
Before going any further, let’s look at the GTK3 to GTK4 migration.
GTK4 has matured now (2021-07). So when writing any more code for GTK3, we should avoid deprecated features and widgets to minimize future efforts.
(My stable Desktop system environment is Debian/Bullseye which is still GTK3.)
API reference of GTK4 is at https://docs.gtk.org/ now(2021-07).
I found the followings to be good references to understand differences between GTK3 and GTK4, and where GTK4 is heading to.
- Migrating from GTK 3.x to GTK 4 – Preparation in GTK 3.x
- Adventures in graphics APIs (2021-05)
- GTK happenings - A new GL Renderer, Popover Shadows, Better Input (2021-02
- Custom widgets in GTK 4 – Introduction (2020-04)
- Another big loser is GtkWindow.
- In GTK 3, all the “popups” (entry completion, menus, tooltips, etc) were using a GtkWindow underneath.
- In GTK 4, most of them have been converted to popovers, and the GtkPopover implementation has been untangled from GtkWindow.
- In addition, many pieces of toplevel-specific functionality have been broken out in separate interfaces called GtkRoot and GtkNative.
- Another big loser is GtkWindow.
- Custom widgets in GTK 4 – Drawing (2020-04)
- Custom widgets in GTK 4 – Layout (2020-04)
- Custom widgets in GTK 4 – Actions (2020-05)
- GTK+ 4 Status Update (2018)
- Gtk.Builder on GTK4
Also, since Nim is similar to Python, GTK4 for Graphical User Interfaces with the Nim Programming Language was interesting to read.
GtkMenuButton and GtkPopover and GAction …
The following may be partially wrong. Just my learning note.
- GtkMenuButton — A widget that shows a popup when clicked on
- This is used to start popover.
- GtkPopover — Context dependent bubbles
- GtkPopoverMenu — Popovers to use as menus
- This is used to start popover.
- GtkModelButton — A button that uses a GAction as model
- This is basically used with GtkApplication and GtkApplicationWindow and not for GtkWindow
- Modelbuttons are used in Gtk.Popover and Gtk.PopoverMenu.
- Gio.GAction is GAction
- See GTK4’s Overview of actions in GTK also.
- GtkApplication and GtkApplicationWindow
- Introduced in GTK3 cycle
- Key part of GTK4 (unseating GtkWindow)
- Gtk.ApplicationWindow can handle both the application menu as well as the menubar.
- Here are a few pages related to this.
Too much info and confusing for me.
Previous Post | Top | Next Post |