Difference between revisions of "GTK+ 4 Migration"

From Inkscape Wiki
Jump to navigation Jump to search
(Mark as outdated.)
 
(15 intermediate revisions by one other user not shown)
Line 1: Line 1:
{{Outdated|message=Please see https://gitlab.com/inkscape/inkscape/-/issues/4802 for a more current listing.}}
'''<big>A page to track the migration to Gtk4.</big>'''
'''<big>A page to track the migration to Gtk4.</big>'''


Line 8: Line 11:
* ☑ Do not use widget style properties (We don't appear to use any.)
* ☑ Do not use widget style properties (We don't appear to use any.)
* ☐ Review your window creation flags  (3x src/ui/widget/color-slider.cpp) DELAY UNTIL GTK4,
* ☐ Review your window creation flags  (3x src/ui/widget/color-slider.cpp) DELAY UNTIL GTK4,
* ☐ Stop using direct access to GdkEvent structs (note: can use GtkEvent structures)
* ☐ Stop using direct access to GdkEvent structs (note: can use GtkEvent structures) '''BIG'''
* ☑ Stop using gdk_pointer_warp()
* ☑ Stop using gdk_pointer_warp()
* ☑ Stop using non-RGBA visuals
* ☑ Stop using non-RGBA visuals
* ☑ gtk_widget_set_app_paintable
* ☑ gtk_widget_set_app_paintable
* ☐ Stop using GtkBox padding, fill and expand child properties
* ☐ Stop using GtkBox padding, fill and expand child properties DELAY UNTIL GTK4
* ☐ Stop using the state argument of GtkStyleContext getters (deprecated in 4.10, gtk_style_context_get_property removed, ui/widget/ink-ruler.cpp, color-slider.cpp, dash-selector.cpp, ink-ruler.cpp, ink-spinscale.cpp; src/ui/util.cpp) DELAY UNTIL GTK4
* ☐ Stop using the state argument of GtkStyleContext getters (deprecated in 4.10, gtk_style_context_get_property removed, ui/widget/ink-ruler.cpp, color-slider.cpp, dash-selector.cpp, ink-ruler.cpp, ink-spinscale.cpp; src/ui/util.cpp) DELAY UNTIL GTK4
* ☑ Stop using gdk_pixbuf_get_from_window() and gdk_cairo_set_source_window()
* ☑ Stop using gdk_pixbuf_get_from_window() and gdk_cairo_set_source_window()
* ☐ Stop using GtkButton's image-related API
* ☐ Stop using GtkButton's image-related API DELAY UNTIL GTK4
* ☐ Stop using GtkWidget event signals (Convert to Controllers, '''BIG''')
* ☐ Stop using GtkWidget event signals (Convert to Controllers, '''BIG''') DELAY UNTIL GTK4 (Controllers mostly unusable in Gtk3.)
* ☑ Set a proper application ID
* ☑ Set a proper application ID
* Stop using gtk_main() and related APIs (2geom tests, autotrace, script)
* Stop using gtk_main() and related APIs (2geom tests, autotrace, script)
* ☑ Reduce the use of gtk_widget_destroy() (Only used for message dialogs and for ComboBoxEnryToolItem which will disappear.)
* ☑ Reduce the use of gtk_widget_destroy() (Only used for message dialogs and for ComboBoxEnryToolItem which will disappear.)
* ☑ Stop using the GtkWidget.destroy vfunc (Not used)
* ☑ Stop using the GtkWidget.destroy vfunc (Not used)
* ☐ Reduce the use of generic container APIs
* ☐ Reduce the use of generic container APIs DELAY UNTIL GTK4
* ☑ Review your use of icon resources
* ☑ Review your use of icon resources


Line 30: Line 33:
* ☐ Life-cycle handling
* ☐ Life-cycle handling
* ☐ Stop using GdkScreen
* ☐ Stop using GdkScreen
* ☐ Stop using the root window
* ☐ Stop using the root window. Used in ege-color-prof-tracker.cpp.
* Stop using GdkVisual
* Stop using GdkVisual. Don't use.
* Stop using GdkDeviceManager
* Stop using GdkDeviceManager. Don't use.
* ☐ Adapt to GdkWindow API changes
* ☐ Adapt to GdkWindow API changes
* ☐ The "iconified" window state has been renamed to "minimized"
* ☐ The "iconified" window state has been renamed to "minimized"
* ☐ Adapt to GdkEvent API changes
* ☐ Adapt to GdkEvent API changes
* Stop using grabs
* Stop using grabs
* ☐ Adapt to coordinate API changes
* ☐ Adapt to coordinate API changes
* ☐ Adapt to GdkKeymap API changes
* ☐ Adapt to GdkKeymap API changes
Line 48: Line 51:
* ☐ Use the new apis for keyboard shortcuts
* ☐ Use the new apis for keyboard shortcuts
* ☐ Stop using GtkEventBox
* ☐ Stop using GtkEventBox
* Stop using GtkButtonBox
* Stop using GtkButtonBox
* ☐ Adapt to GtkBox API changes
* ☐ Adapt to GtkBox API changes
* ☐ Adapt to GtkWindow API changes
* ☐ Adapt to GtkWindow API changes
* Adapt to GtkHeaderBar and GtkActionBar API changes
* Adapt to GtkHeaderBar and GtkActionBar API changes. Don't use either.
* ☐ Adapt to GtkStack, GtkAssistant and GtkNotebook API changes
* ☐ Adapt to GtkStack, GtkAssistant and GtkNotebook API changes Don't use GtkAssistant
* ☐ Adapt to button class hierarchy changes
* ☐ Adapt to button class hierarchy changes
* ☐ Adapt to GtkScrolledWindow API changes
* ☐ Adapt to GtkScrolledWindow API changes
Line 59: Line 62:
* ☐ Stop using GtkContainer::border-width
* ☐ Stop using GtkContainer::border-width
* ☐ Adapt to coordinate API changes
* ☐ Adapt to coordinate API changes
* ☐ Adapt to GtkStyleContext API changes
* ☐ Adapt to GtkStyleContext API changes Gtk::StyleContext::add_provider_for_screen -> add_provider_for_display.
* ☐ Adapt to GtkCssProvider API changes
* ☐ Adapt to GtkCssProvider API changes
* ☐ Stop using GtkShadowType and GtkRelief properties
* ☐ Stop using GtkShadowType and GtkRelief properties
Line 65: Line 68:
* ☐ Adapt to GtkWidget's size allocation changes
* ☐ Adapt to GtkWidget's size allocation changes
* ☐ Switch to GtkWidget's children APIs
* ☐ Switch to GtkWidget's children APIs
* Don't use -gtk-gradient in your CSS
* Don't use -gtk-gradient in your CSS
* ☐ Don't use -gtk-icon-effect in your CSS
* ☐ Don't use -gtk-icon-effect in your CSS Used in style.css, Minwaita-Inkscape.css
* Don't use -gtk-icon-theme in your CSS
* Don't use -gtk-icon-theme in your CSS
* ☐ Don't use -gtk-outline-...-radius in your CSS
* ☐ Don't use -gtk-outline-...-radius in your CSS Used in style.css, Minwaita-Inkscape.css
* ☐ Adapt to drawing model changes
* ☐ Adapt to drawing model changes
* ☐ Stop using APIs to query GdkSurfaces
* ☐ Stop using APIs to query GdkSurfaces
Line 85: Line 88:
* ☐ Adapt to changes in the GtkAssistant API
* ☐ Adapt to changes in the GtkAssistant API
* ☐ Adapt to changes in the API of GtkEntry, GtkSearchEntry and GtkSpinButton
* ☐ Adapt to changes in the API of GtkEntry, GtkSearchEntry and GtkSpinButton
* Adapt to changes in GtkOverlay
* Adapt to changes in GtkOverlay. Don't use changed api.
* Use GtkFixed instead of GtkLayout
* Use GtkFixed instead of GtkLayout. Don't use.
* Adapt to search entry changes
* Adapt to search entry changes. Don't use changed api.
* ☐ Adapt to GtkScale changes
* ☐ Adapt to GtkScale changes
* ☐ Stop using gtk_window_activate_default()
* ☐ Stop using gtk_window_activate_default()

Latest revision as of 23:01, 6 June 2024

This page is outdated. It is kept for historical reasons, e.g. to document specific decisions in Inkscape development.

Please see https://gitlab.com/inkscape/inkscape/-/issues/4802 for a more current listing.


A page to track the migration to Gtk4.

See: https://docs.gtk.org/gtk4/migrating-3to4.html

Preparation:

  • ☑ Do not use GTK-specific command line arguments
  • ☑ Do not use widget style properties (We don't appear to use any.)
  • ☐ Review your window creation flags (3x src/ui/widget/color-slider.cpp) DELAY UNTIL GTK4,
  • ☐ Stop using direct access to GdkEvent structs (note: can use GtkEvent structures) BIG
  • ☑ Stop using gdk_pointer_warp()
  • ☑ Stop using non-RGBA visuals
  • ☑ gtk_widget_set_app_paintable
  • ☐ Stop using GtkBox padding, fill and expand child properties DELAY UNTIL GTK4
  • ☐ Stop using the state argument of GtkStyleContext getters (deprecated in 4.10, gtk_style_context_get_property removed, ui/widget/ink-ruler.cpp, color-slider.cpp, dash-selector.cpp, ink-ruler.cpp, ink-spinscale.cpp; src/ui/util.cpp) DELAY UNTIL GTK4
  • ☑ Stop using gdk_pixbuf_get_from_window() and gdk_cairo_set_source_window()
  • ☐ Stop using GtkButton's image-related API DELAY UNTIL GTK4
  • ☐ Stop using GtkWidget event signals (Convert to Controllers, BIG) DELAY UNTIL GTK4 (Controllers mostly unusable in Gtk3.)
  • ☑ Set a proper application ID
  • ☑ Stop using gtk_main() and related APIs (2geom tests, autotrace, script)
  • ☑ Reduce the use of gtk_widget_destroy() (Only used for message dialogs and for ComboBoxEnryToolItem which will disappear.)
  • ☑ Stop using the GtkWidget.destroy vfunc (Not used)
  • ☐ Reduce the use of generic container APIs DELAY UNTIL GTK4
  • ☑ Review your use of icon resources

At time of switch:

Some of these we maybe able to do earlier.

  • ☐ Subclassing widgets
  • ☐ Life-cycle handling
  • ☐ Stop using GdkScreen
  • ☐ Stop using the root window. Used in ege-color-prof-tracker.cpp.
  • ☑ Stop using GdkVisual. Don't use.
  • ☑ Stop using GdkDeviceManager. Don't use.
  • ☐ Adapt to GdkWindow API changes
  • ☐ The "iconified" window state has been renamed to "minimized"
  • ☐ Adapt to GdkEvent API changes
  • ☑ Stop using grabs
  • ☐ Adapt to coordinate API changes
  • ☐ Adapt to GdkKeymap API changes
  • ☐ Adapt to changes in keyboard modifier handling
  • ☐ Replace GtkClipboard with GdkClipboard
  • ☐ Stop using gtk_get_current_... APIs
  • ☐ Convert your UI files
  • ☐ Adapt to GtkBuilder API changes
  • ☐ Adapt to event controller API changes
  • ☐ Focus handling changes
  • ☐ Use the new apis for keyboard shortcuts
  • ☐ Stop using GtkEventBox
  • ☑ Stop using GtkButtonBox
  • ☐ Adapt to GtkBox API changes
  • ☐ Adapt to GtkWindow API changes
  • ☑ Adapt to GtkHeaderBar and GtkActionBar API changes. Don't use either.
  • ☐ Adapt to GtkStack, GtkAssistant and GtkNotebook API changes Don't use GtkAssistant
  • ☐ Adapt to button class hierarchy changes
  • ☐ Adapt to GtkScrolledWindow API changes
  • ☐ Adapt to GtkBin removal
  • ☐ Adapt to GtkContainer removal
  • ☐ Stop using GtkContainer::border-width
  • ☐ Adapt to coordinate API changes
  • ☐ Adapt to GtkStyleContext API changes Gtk::StyleContext::add_provider_for_screen -> add_provider_for_display.
  • ☐ Adapt to GtkCssProvider API changes
  • ☐ Stop using GtkShadowType and GtkRelief properties
  • ☐ Adapt to GtkWidget's size request changes
  • ☐ Adapt to GtkWidget's size allocation changes
  • ☐ Switch to GtkWidget's children APIs
  • ☑ Don't use -gtk-gradient in your CSS
  • ☐ Don't use -gtk-icon-effect in your CSS Used in style.css, Minwaita-Inkscape.css
  • ☑ Don't use -gtk-icon-theme in your CSS
  • ☐ Don't use -gtk-outline-...-radius in your CSS Used in style.css, Minwaita-Inkscape.css
  • ☐ Adapt to drawing model changes
  • ☐ Stop using APIs to query GdkSurfaces
  • ☐ Widgets are now visible by default
  • ☐ Adapt to changes in animated hiding and showing of widgets
  • ☐ Stop passing commandline arguments to gtk_init
  • ☐ GdkPixbuf is deemphasized
  • ☐ GtkWidget event signals are removed
  • ☐ Invalidation handling has changed
  • ☐ Stop using GtkWidget::draw
  • ☐ Window content observation has changed
  • ☐ Monitor handling has changed
  • ☐ Adapt to monitor API changes
  • ☐ Adapt to cursor API changes
  • ☐ Adapt to icon size API changes
  • ☐ Adapt to changes in the GtkAssistant API
  • ☐ Adapt to changes in the API of GtkEntry, GtkSearchEntry and GtkSpinButton
  • ☑ Adapt to changes in GtkOverlay. Don't use changed api.
  • ☑ Use GtkFixed instead of GtkLayout. Don't use.
  • ☑ Adapt to search entry changes. Don't use changed api.
  • ☐ Adapt to GtkScale changes
  • ☐ Stop using gtk_window_activate_default()
  • ☐ Stop using gtk_widget_grab_default()
  • ☐ Stop setting ::has-default and ::has-focus in .ui files
  • ☐ Stop using the GtkWidget::display-changed signal
  • ☐ GtkPopover::modal has been renamed to autohide
  • ☐ gtk_widget_get_surface has been removed
  • ☐ gtk_widget_is_toplevel has been removed
  • ☐ gtk_widget_get_toplevel has been removed
  • ☐ GtkEntryBuffer ::deleted-text has changed
  • ☐ GtkMenu, GtkMenuBar and GtkMenuItem are gone
  • ☐ GtkToolbar has been removed
  • ☐ GtkAspectFrame is no longer a frame
  • ☐ Stop using custom tooltip windows
  • ☐ Switch to the new Drag-and-Drop api
  • ☐ Adapt to GtkIconTheme API changes
  • ☐ Adapt to GtkImage changes
  • ☐ Update to GtkFileChooser API changes
  • ☐ Stop using blocking dialog functions
  • ☐ Stop using GtkBuildable API
  • ☐ Adapt to GtkAboutDialog API changes
  • ☐ Adapt to GtkTreeView and GtkIconView tooltip context changes
  • ☐ Adapt to GtkPopover changes
  • ☐ Stop using GtkFileChooserButton
  • ☐ Adapt to changed GtkSettings properties

After switch:

  • ☐ Use new list widgets.