capsule/content/gemlog/exploring_adaptive_widgets_using_gtk4.gmi

18 lines
2.3 KiB
Text
Raw Normal View History

Meta(
title: "Exploring adaptive widgets using Gtk4",
summary: Some("I\'m considering a new direction in my personal projects, moving from Rust back to C, and potentially replacing my previous Gemini browser Eva."),
published: None,
tags: [
"programming",
"C",
"gtk",
"libadwaita",
],
)
---
Recently I've been spending some time re-familiarizing myself with C after growing more disillusioned with Rust and other "modern" programming languages. I've already laid out my reasons in an earlier post, but I want to add a reason that I hadn't previously iterated on. Namely, I've realized that no matter how portable all of these modern languages claim to be, nothing is as portable as C. I see it in how BSD systems get treated as second class citizens and by how often things break when attempting to compile for architectures such as RiscV.
I've done a fair amount of Gui programming in the past, mostly using Gtk+. I've become rather familiar with how the toolkit works after using it in conjunction with several languages, but my experience using it in C has up to now been limited to some toy projects that I never really shared with anyone. My most complete projects use Rust and Vala. I love the Vala experience on the whole, but using the gtk-rs bindings can be a little rough. In hindsight, it's obvious that using a GObject, reference counted framework is rather at odds with Rust's memory ownership model, and frankly I've grown tired of fighting it. While I'll likely continue maintaining Gfret for some time I've given serious thought to sunsetting my gtk-rs based small web browser, Eva, and starting something new in it's place with some of the lessons learned. With some of the new adaptive features set to come out in the next release of libadwaita, I figured now might be a great time to explore this a little more.
The biggest new feature coming in libadwaita-1.4 is the AdwBreakpoint class. This provides a high level interface to rearrange your interface in arbitrary ways based on the window size. These things were technically possible before, but required a lot of manual work to implement since the move to Gtk4. But what the new code means is that it's now going to be trivially easy to support running the same codebase on a desktop computer as on a mobile device such as the Pinephone.