GTK+ 3 issues

From Inkscape Wiki
Revision as of 01:44, 21 May 2016 by ~suv (talk | contribs) (→‎Standard Practice: fix formatting as bullet list (remove space in first column))
Jump to navigation Jump to 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:


Document your issues with porting Inkscape to Gtk3 below.

  • GTK 3 Bugs
  • Building with Gdk 3.20 and --enable-strict-build (default) fails due to deprecated symbols. Use --enable-strict-build=no.
  • 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 launchpad bug #1201545.
    • This might have been fixed by r14870 - the icon clipping problem.
    • Don't see why r14870 would have fixed this. r14871 disables the overlaid scrollbars introduced by Gtk3 3.16.
    • The 'Wrap' option doubles the height of the swatches but doesn't actually do any wrapping.
  • 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.
  • All custom widgets now use the Cairo drawing model. All need to be fully tested, and several (e.g., the filter editor) are not rendered correctly.
  • Several of the Gtk+ widgets have changed their layout (in particular, the GtkSpinButton is now much wider). Many of the toolbars now overflow the screen horizontally, and many dialogs are now far too wide. The layout of affected containers should be redesigned to account for this.
  • The rules for sizing of widgets within containers has changed in Gtk+ 3. In many cases, widgets will initially appear far too big, or with zero size. All dialogs and containers need to be checked for these issues.
  • Mac Issues:
  • 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.
  • Window size preference "Small" does not result in a small window.
  • 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:

Standard Practice

List any repetitive actions during the upgrade and note anything that needed doing when moving from gtk2 to gtk3 widgets (for examine hbox and vbox) 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.

Use GtkInspector:

  GTK_DEBUG=interactive ~/path_to_gtk3/bin/inkscape


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

  • Rulers - src/widgets/ruler.cpp
    • Should probably be updated from GIMP.
  • SPIcon - src/widgets/icon.cpp
    • 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)


Any ideas which are interesting

* No ideas yet

Deferred changes

Work items, which should be carried out after the release of Inkscape 0.93. 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.

  • 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).