Skip to content

Instantly share code, notes, and snippets.

@mjakeman
Created October 25, 2022 16:27
Show Gist options
  • Save mjakeman/d632e52a8679eec4025602b2457a8f92 to your computer and use it in GitHub Desktop.
Save mjakeman/d632e52a8679eec4025602b2457a8f92 to your computer and use it in GitHub Desktop.
Let's port inkscape to gtk4

Inkscape GTK 4 Port

What needs to be done?

GTK3 Backport Branch: https://gitlab.com/firox263/inkscape/-/tree/gtk4-prep-events GTK4 Transition Branch: https://gitlab.com/firox263/inkscape/-/tree/gtk4

Pre-Switch

  • Replace all direct uses of GdkEvent
  • Try move to event controllers where possible (not easy because GtkGestureClick doesn’t exist in GTK 3, which is basically all uses in Inkscape)
  • Stop using generic containers (should be fine, only toolbars which currently use it)
  • There are no deprecated structures in Inkscape!
    • Well, almost…
    • Need to migrate away from a few properties like use-stock

Switch

  • Adapt to GdkEvent name/type changes
    • It is no longer a union, so changes needed
  • Adapt to libsigc++ changes
    • Seems to be ridiculously more verbose for some uses
    • How to keep static type parameters while keeping it readable?
  • Adapt to drag and drop changes
    • New API is much more sanely designed
    • How much does Inkscape use drag and drop?

Post-Switch

  • Probably move from GtkEventControllerLegacy to the relevant event controllers like GtkGestureClick and what not
  • Touch support for free!
  • Move from deprecated GtkTreeView and friends to new fancy list widgets
  • Enable OpenGL canvas drawing and/or use GtkSnapshot

Questions

  • Platform support
    • GTK4 on Windows… rough (worse than GTK3, but seems pretty active)
    • GTK4 on macOS… great-ish (much better than GTK3, although see gtk!4523)
  • Gtkmm is being deprecated (see: gtkmm#110)
    • Write more or less gtkmm code?
  • libadwaita? 👀
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment