Nicer structure
This commit is contained in:
16
AGENTS.md
16
AGENTS.md
@@ -4,7 +4,7 @@
|
||||
A pure GTK4 C++ GUI for remapping the G1–G9 keys of a Logitech G910. Today it
|
||||
only edits and persists mappings: there is **no** hardware G-key detection and
|
||||
**no** command execution yet (a native daemon is the planned next step). The
|
||||
whole program is one translation unit, `src/main.cpp`.
|
||||
code is split into a few small translation units under `src/` (see below).
|
||||
|
||||
## Build / run / verify
|
||||
- `make` — builds the `gkeymapper` binary **and** the `.mo` catalogs.
|
||||
@@ -30,10 +30,16 @@ whole program is one translation unit, `src/main.cpp`.
|
||||
`po/de.po`.
|
||||
|
||||
## Code layout and conventions
|
||||
- `src/main.cpp` holds everything in an anonymous namespace. The global `rows`
|
||||
vector keeps one `KeyRow` (widget pointers) per G key. `on_activate` registers
|
||||
the app actions `app.export-config`, `app.import-config`, `app.about`;
|
||||
`build_ui` constructs the window. App id: `com.example.gkeymapper`.
|
||||
- Modules under `src/` (shared API lives in `namespace gkeymapper`):
|
||||
`keyrow.h` (`KeyRow`, `kNumKeys`), `mappings.{h,cpp}` (config file I/O),
|
||||
`capturedialog.{h,cpp}` (key-capture dialog), `main.cpp` (app actions + UI).
|
||||
- The Makefile globs sources (`$(wildcard src/*.cpp)`): a new `.cpp` is compiled
|
||||
automatically, and `src/*.h` are prerequisites of the target.
|
||||
- `main.cpp` keeps the `rows` vector (one `KeyRow` per G key, widget pointers)
|
||||
in an anonymous namespace; mappings functions receive it as a parameter.
|
||||
`on_activate` registers the app actions `app.export-config`,
|
||||
`app.import-config`, `app.about`; `build_ui` constructs the window. App id:
|
||||
`com.example.gkeymapper`.
|
||||
- The Type dropdown index is meaningful everywhere: `0=Key`, `1=Command`,
|
||||
`2=Disabled`. Keep that order — import/export map against it.
|
||||
- The capture dialog's `CaptureSession` is heap-allocated and freed only by the
|
||||
|
||||
Reference in New Issue
Block a user