refactor: build the shortcut overview from AdwShortcutsDialog
The hand-rolled grid existed to avoid GTK's deprecated GtkShortcutsWindow; libadwaita 1.8's AdwShortcutsDialog is the supported replacement, so use the platform widget and get its search, sectioning and shortcut labels for free. The table strings become GTK accelerator syntax, since the shortcut label parses them. The six mouse rows cannot: no accelerator syntax names a wheel or a drag, so they carry an empty accelerator and prose in the new subtitle field. adw_init() is called in run_ui() and in choose_source() (replacing its gtk_init()), which means the whole app is drawn with libadwaita's stylesheet. Verified settled: viewport.w 870..870, axes.w changes 2, x-desync 0. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
1 parent
018b98eddf
commit
d65a121a9a
7 files changed
+123
-92
No files matched your search
@@ -5,6 +5,7 @@
|
||||
|
||||
#include "layout_store.hpp"
|
||||
|
||||
#include <adwaita.h>
|
||||
#include <gtk/gtk.h>
|
||||
|
||||
#include <cstdio>
|
||||
@@ -351,7 +352,10 @@ bool choose_source(Config& cfg) {
|
||||
return false;
|
||||
}
|
||||
|
||||
gtk_init();
|
||||
// `adw_init()` rather than `gtk_init()`: it does everything the latter does and also
|
||||
// installs libadwaita's stylesheet, which the shortcut overview's `AdwShortcutsDialog`
|
||||
// is drawn with. Both are idempotent, so `run_ui()` calling it again costs nothing.
|
||||
adw_init();
|
||||
|
||||
Chooser c;
|
||||
c.cfg = &cfg;
|
||||
|
||||
Reference in new issue
Block a user