-
Pl
chevron_right
Michael Calabrese: Pitivi Timeline Ruler | Widget Maturing
news.movim.eu / PlanetGnome • 1 day ago • 2 minutes
Hello GNOME, This is a progress report on the Pitivi Timeline Ruler Rust rewrite.
Progress
We are rewriting the Pitivi Ruler in Rust using a modern
GtkSnapshot
rendering pipeline to improve performance and memory safety. At its current stage the ruler is being constructed as a standalone widget in a personal repository that can be found here:
GTK_DEBUG=interactive cargo run --example sandbox
Any feedback on the code is greatly appreciated!
Updates
The widget is drawing well and a lot of the initial bugs have been ironed out.
A major structural change that has been made after mentor feedback was to pull state orchestration out of the widget itself, and keep more of the logic on the app side. The goal is a "dumb widget, smart app" framework, where the ruler acts as a stateless viewport. The app (or sandbox example) provides the logic for how to handle gestures and what to do when the user interacts with the widget. One example of this is that
project_duration
was removed as a property entirely, and logic around bounds is now handled entirely on the app side. This allows the widget to be used in a variety of contexts, and allows the app to handle bounds in whatever way is appropriate for the context.
Beyond the pivot on structure, some key systems-level refinements were made:
-
Property types we refactored heavily as this moved past the rough prototype stage.
zoom_levelreceived a rename tons_per_pixelto better reflect what the property actually represents. Many properties dealing with pixels were changed to unsigned integers, which allowed me to delete out some negative checks. -
The project does now include a rough doc string and comment draft for the widget, which will be fleshed out more as the widget matures and more of the public API is finalized.
-
Cache clearing was added to
set_ns_per_pixelto prevent modulo math escapes during purging of cached layouts when users change the zoom level.
Next Steps
The major milestone ahead is the implementation of a custom
gtk::LayoutManager
to handle the layout of children widgets.
Once the
PitiviTimelineLayoutManager
is implemented, the playhead rendering will be moved out of the ruler's snapshot pipeline and into the layout manager as a distinct child widget. This will allow Pitivi to easily inject custom markers, loop-brackets, and multiple playheads without modifying the underlying ruler engine.
I am currently studying Marc-André Lureau's
rdw
(Remote Desktop Widget) repository as a guide on how to make this update.