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
+11
-1
@@ -12,6 +12,15 @@ endif()
|
||||
|
||||
find_package(Threads REQUIRED)
|
||||
|
||||
# --- libadwaita: the shortcut overview ---------------------------------------
|
||||
# GTK4's own `GtkShortcutsWindow` is deprecated as of 4.18 and libadwaita's
|
||||
# `AdwShortcutsDialog` (1.8) is its replacement, so the overview is built from the
|
||||
# platform widget rather than from a hand-rolled grid. This is the only thing libadwaita
|
||||
# is used for; `adw_init()` is called for it, which also means the app picks up
|
||||
# libadwaita's stylesheet.
|
||||
find_package(PkgConfig REQUIRED)
|
||||
pkg_check_modules(ADWAITA REQUIRED IMPORTED_TARGET libadwaita-1>=1.8)
|
||||
|
||||
# --- deps/plotter: built from the submodule, GTK4 adapter only ----------------
|
||||
set(PLOT_BUILD_TESTS OFF CACHE BOOL "" FORCE)
|
||||
set(PLOT_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
|
||||
@@ -109,7 +118,8 @@ add_executable(udpscope
|
||||
)
|
||||
|
||||
target_include_directories(udpscope PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/src)
|
||||
target_link_libraries(udpscope PRIVATE plot::gtk4 udpsclient Threads::Threads)
|
||||
target_link_libraries(udpscope PRIVATE plot::gtk4 udpsclient Threads::Threads
|
||||
PkgConfig::ADWAITA)
|
||||
add_dependencies(udpscope udpscope_build_info)
|
||||
if(CMAKE_CXX_COMPILER_ID MATCHES "GNU|Clang")
|
||||
target_compile_options(udpscope PRIVATE -Wall -Wextra -Wpedantic)
|
||||
|
||||
Reference in new issue
Block a user