GTK+ 4 issues

From Inkscape Wiki
Jump to navigation Jump to search


Specific Issues

Toolbars

Gtk::Toolbar and related widgets have been removed as "outdated". The suggested replacement is a Gtk::Box with normal widgets. This means that toolbars will have a minimum width defined by the sum of the widths of their child widgets rather being allowed to shrink to a smaller width with "over-flowing" widgets being replaced by a drop-down menu at the end of the toolbar. This requires us to re-think our toolbars.

In practice, many of the replacement menu items for dropped widgets are not very practical. Having toolbars that are quite wide probably is a sign of poor design. Many of the current toolbar widgets could be packed in non-modal popovers, that is, pop-up menus that stay open until dismissed. It would be relatively easy to then reduce most toolbar widths to less than 1000 pixels. The most difficult toolbar to reduce in size is the main toolbar. This could be dealt with by removing all the dialog buttons. One might think of putting all dialogs into a new menu bar sub-menu or into a modal popover.

Example of replacing some toolbar widgets with a popover.

The longest toolbars (width):

  1. Text (1650)
  2. Calligraphy (1450)
  3. Main Toolbar (1350 - Horizontal, 950 - Vertical)
  4. Selector (1300)
  5. Spray Paint (1300)
  6. Node (1250)
  7. Ruler (1100)
  8. Eraser (1050)
  9. Tweak (1050)
  10. Tool Toolbar (800 - Vertical)
  11. Snapping (750 - Vertical)

We need to decide on the minimum size window we should target. The current minimum window size is about 811x524 pixels with main toolbar on top. Most modern budget displays are 1366x768 and are about 20% of desktop use them. A smaller fraction of about 5% use 1280x720. See https://gs.statcounter.com/screen-resolution-stats/desktop/worldwide .

Menus

GTK4 uses menus based on Gio::Menu using Gio::Actions. These are easy to construct with .ui files. They automatically keep in sync with action states and with shortcuts. We are moving to them for the main menu bar in GTK3.

Gio::Menus do have some issues. The first, and perhaps the most important, is with icons. Icons can be specified in the .ui files. In GTK3 they are always shown while in GTK4 they are never shown. There doesn't seem to be any way to toggle their 'visibility' (the icons are there in GTK4 as demonstrated by using the GTK Inspector tool). See: https://discourse.gnome.org/t/toggling-on-off-icon-visibility-in-gmenu-items/7234/2 .

There are several possible solutions to this problem. One is to abandon icons. I do agree that they are rarely really useful... but there are cases where they are helpful. It much easier to understand the direction of rotation from an arrow than remembering what "CW" means. Some icons could be replaced by using Unicode characters:

  • ⮷ Rotate 90 CW
  • ⮶ Rotate 90 CCW
  • 🡘 Flip Horizontally
  • ⭥Flip Vertically
  • ⤒Raise to top

Another solution would be to dissect the GTK Inspector code to learn how to toggle the 'visibility' property (note, this is not a CSS property). For GTK3 it would also be possible to provide three different .ui files, one with all icons, one with just a handful, and one with none.

Useful Links

  1. Migrating from Gtk3 to Gtk4
  2. Changes in gtkmm-4.0 and glibmm-2.68