Difference between revisions of "GTK+ 3 issues"
m (→Standard Practice: fix formatting as bullet list (remove space in first column)) |
|||
Line 49: | Line 49: | ||
* A number of places in our code we use hard coded CSS. | * A number of places in our code we use hard coded CSS. | ||
** spw-utilities.cpp <code>GtkWidget { font-size: 12pt; }</code> (In utility for setting font size of widgets.) | ** spw-utilities.cpp <code>GtkWidget { font-size: 12pt; }</code> (In utility for setting font size of widgets.) | ||
** ruler.cpp <code>SPRuler { background-color: @bg_color; }</code> | ** ruler.cpp <code>SPRuler { background-color: @bg_color; }</code> Removed r14876. | ||
** svg-view-widget.cpp <code>SPCanvas { background-color: white; }</code> | ** svg-view-widget.cpp <code>SPCanvas { background-color: white; }</code> | ||
** desktop-widget.cpp <code>GtkWidget { padding-left: 0; ... }</code> (Restricted to Lock guides) | ** desktop-widget.cpp <code>GtkWidget { padding-left: 0; ... }</code> (Restricted to Lock guides) |
Revision as of 11:41, 23 May 2016
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:
Issues
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:
- No tablet input support on Mac (e.g. Wacom). MyPaint seems to be working on this.
- Support for global menu bar.
- GEdit uses OSX menu bar and has native file dialogs
- 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: https://bugzilla.gnome.org/show_bug.cgi?id=765700
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.
- 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:
- https://bugzilla.gnome.org/show_bug.cgi?id=765433
- https://blogs.gnome.org/mclasen/2015/11/20/a-gtk-update/
- https://feaneron.com/2016/01/04/quick-guide-to-port-an-app-for-gtk-3-20/
- Looks like we'll need a lot of #ifdefs to handle the changes in 3.20.
- It appears possible to have separate style files for pre 3.20 and 3.20 but I (Tav) don't know how to do this.
- 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 { ... }
- spw-utilities.cpp
- 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/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:
- Handles custom size: Inkscape::ICON_SIZE_DECORATION
- Old to new icon name conversion
- Rendering icons from icon.svg
- 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)
- Used for things like Height, Width
- Internally uses GtkSpinbutton which has large '+' '-' buttons. See https://developer.gnome.org/gtk3/stable/GtkSpinButton.html
Ideas
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).