GTK+ 3 issues

From Inkscape Wiki
(Redirected from Gtk issues)
Jump to: navigation, search

This page is for GTK+ documentation, any issues, questions or notes about the porting of Inkscape to Gtk3. This document will be sent to the GTK+/GNOME developers and may be useful for GIMP developers who undergo the same process.

Other pages:

External resources:

  • gtk+ IRC channel: irc.gnome.org (GIMPNet) #gtk+

Issues

Document your issues with porting Inkscape to Gtk3 below.

Updated 13 November 2017

  • Widgets
    • All custom widgets now use the Cairo drawing model; some are now not rendered correctly:
      • Filter Editor. Custom widget fixed to work as in GTK2; rewrite desired (started at Hackfest 2017) but not required.
    • Gtk+ 3 widgets have changed as well as rules for sizing widgets inside containers. Widgets may be bigger (e.g GtkSpinButton) or may appear with zero size. All toolbars and dialogs need to be checked:
      • Text Toolbar is too wide.
      • Spray Toolbar is too wide.
      • Transform dialog too wide (matrix tab)
    • The text "Blur" and "Opacity" inside the "interactive progress bar" widgets (are these custom widgets?) in Fill and stroke dialog are cut in half or less, and are rendered unreadable.
      • There is also some different modes of interaction, with top half of the widgets meaning "move instantly to this point" and (part of) bottom half meaning "slightly adjust value", however the latter is really hard to use as it's something like on or two pixel rows high.
      • Inconsistency between Blur and Opacity in Objects dialog (also different from Fill and Stroke dialog).
    • Default window size preference does not work.
    • Jumping palette. The color bar/palette does not seem to be able to decide how high it should be, at least for some combinations of palette width, height, etc. See bug lp:1201545.
    • Gtk 3.20: "Gtk-WARNING **: Allocating size to GdlDock 0x4ca2930 without calling gtk_widget_get_preferred_width/height(). How does the code know the size to allocate?" Maybe not our bug, see: https://bugzilla.gnome.org/show_bug.cgi?id=765700
  • Icons
    • Icons are too small / cut. (if someone can find the launchpad bug for this one, please add link here). This is probably caused by the use of SPIcon instead of a standard GtkImage widget.
      • The clipping of icons in the toolbar is fixed in r14870. Problem had to do with custom button widget which wraps icon. The preferred/minimum width/height was not taking into account the padding around the icon.
    • We have too many ways of creating buttons with icons which leads to inconsistency of behavior.
    • Icons are now separate SVG files but theming does not work.
    • Icons are missing in toolbars until window resized.
  • Build Issues
    • Building with Gdk 3.20 and --enable-strict-build (default) fails due to deprecated symbols. Use --enable-strict-build=no.

Standard Practice

List any repetitive actions during the upgrade and note anything that needed doing when moving from gtk2 to gtk3 widgets; be clear if the action is using gtk3 or gtkmm (which often papers over some of the move to gtk3).

  • GtkHBox and GtkVBox are now just GtkBox with an orientation attribute.
  • Changing to Gtk::Box is a quick fix but there is a warning in the documentation that Gtk::Box will eventually be removed. Gtk::Grid is the "proper" replacement.

We should switch to using CSS styling.

  • See: http://www.gtkforums.com/viewtopic.php?f=3&t=988&p=72088=GTK3+with+CSS#p72088
  • Ruler code uses CSS styling but @bg_color doesn't seem to be defined. I (Tav) have hard coded off-white for the moment. This works in 3.18 but is ignored in 3.20. The CSS API changed in 3.20. See:
  • A number of places in our code we use hard coded CSS.
    • spw-utilities.cpp GtkWidget { font-size: 12pt; } (In utility for setting font size of widgets.)
    • ruler.cpp SPRuler { background-color: @bg_color; } Removed r14876.
    • svg-view-widget.cpp SPCanvas { background-color: white; }
    • desktop-widget.cpp GtkWidget { padding-left: 0; ... } (Restricted to Lock guides)
    • font-selector.cpp #font_selector_family { -GtkWidget-wide-seperators: true; -GtkWidget-seperator-height: 6; }
    • text-toolbar.cpp #TextFontFamilyAction_combobox { ... } combobox window.popup scrolledwindow treeview seperator { ... }
  • We should standardize the widget naming scheme.

Use GtkInspector:

  GTK_DEBUG=interactive ~/path_to_gtk3/bin/inkscape

Widgets

List any and all custom widgets currently being used in Inkscape.

  • Rulers - src/widgets/gimp/ruler.cpp (moved from src/widgets/ruler.cpp)
    • Should probably be updated from GIMP.
  • SPIcon - src/widgets/icon.cpp Removed
    • Should be replaced with regular GtkImage.
    • SPIcon does more than rendering the icon:
      1. Handles custom size: Inkscape::ICON_SIZE_DECORATION
      2. Old to new icon name conversion
      3. Rendering icons from icon.svg
      4. Rendering into cache
    • All the above could be removed.
  • SPCanvas - src/display/sp-canvas.cpp
    • Needs to stay a custom widget. Fixed for GTK3.
  • EgeAdjustmentAction (ege-adjustment-action.h/.cpp)

Ideas

Any ideas which are interesting.

  • No ideas yet…

Deferred changes

Work items, which should be carried out after the release of Inkscape 0.92. These are tasks, which would be impractical to perform until after we have permanently ended our support for Gtk+ 2. For example, these may make use of new Gtk+ 3 features, which have no simple fallback available in Gtk+ 2.

  • [DONE] Delete all Gtk+ 2 backward-compatibility code. This will remove over 700 blocks of conditional build instructions from our code base, and thousands of lines of redundant code. This is essential for future maintainability, and will greatly simplify future work on Gtk+ 3 features.
  • Load all theme information from an external CSS style sheet. This will potentially tidy our code by removing hard-coded styling instructions, and will make it possible to properly apply user themes to Inkscape.
  • Switch to using a GtkIconTheme, with all custom icons installed in a standard way instead of bundled within a single SVG document. This will make it easier to provide user icon themes, and get rid of a lot of deprecated code.
    • We should also unify all the code for creating buttons with icons.
    • GTK3 respects the HiDPI setting while GTK2 does not. System icons are rendered with high DPI when needed but Inkscape specific icons are not. This will probably be fixed by moving to GtkIconTheme.
    • Many GTK methods using GtkIconSize have been deprecated but GtkIconSize itself has not been. This can be confusing. We have a custom value for GtkIconSize that we should try to remove.
  • Switch to using GtkApplication instead of GtkMain.
  • Switch to using GAction instead of GtkAction <- this one might be deferred indefinitely; see Gimp's direction for comparison (Gimp has stated they will not switch).

GTK+ 3 Versions

How far back do we need to support? See: https://distrowatch.com

Ubuntu:

Release End of Life GTK+ 3 Version
14.04 LTS (Trusty) 2019/04 3.10
16.04 LTS (Xenial) 2021/04 3.18
16.10 (Zesty) 2018/01 3.22.11
16.10 (Artful) 2018/07 3.22.24
Snapshot 3.22.24

Fedora:

Release End of Life GTK+ 3 Version
25 2017/12? 3.22.17
26 2018/08? 3.24 (3.22.21)
Rawhide 3.26 (3.22.24)

Redhat:

Release End of Life GTK+ 3 Version
6.9 2020/11 Not supported
7.4 2024/11 3.22.10