refactor: move the event loop into the library as app::run (prep for Issue #42)
src/main.rs is now only the desktop entry point; the app itself lives in src/app.rs, so other entry points such as android_main can start it. The code is unchanged apart from crate:: paths; the source scans in the i18n and UI tests and the docs point to app.rs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
e8a7675f8d
commit
b11fb2d762
10 files changed
+4293
-4281
No files matched your search
+3
-2
@@ -152,8 +152,9 @@ Die CI prüft zusätzlich `cargo fmt --check` und `cargo clippy --all-targets --
|
||||
|
||||
```text
|
||||
src/
|
||||
├── main.rs # Event-Loop (winit), Eingaben von Maus, Touch und Stift, Ablaufsteuerung
|
||||
├── lib.rs # Bibliotheks-Exporte (für Tests)
|
||||
├── main.rs # Einstieg für den Desktop, startet app::run
|
||||
├── app.rs # Event-Loop (winit), Eingaben von Maus, Touch und Stift, Ablaufsteuerung
|
||||
├── lib.rs # Bibliotheks-Exporte (App und Module, auch für Tests)
|
||||
├── canvas.rs # wgpu-Rendering: Papier, Muster, Bilder, Tinte, Nachbarseiten
|
||||
├── shader.wgsl # Vertex- und Fragment-Shader
|
||||
├── viewport.rs # Kamera (Zoom, Verschieben), Seitenstapel der durchgehenden Ansicht
|
||||
|
||||
@@ -154,8 +154,9 @@ New code comments and commit messages are written in English; older code and his
|
||||
|
||||
```text
|
||||
src/
|
||||
├── main.rs # Event loop (winit), mouse, touch and pen input, control flow
|
||||
├── lib.rs # Library exports (for tests)
|
||||
├── main.rs # Desktop entry point, starts app::run
|
||||
├── app.rs # Event loop (winit), mouse, touch and pen input, control flow
|
||||
├── lib.rs # Library exports (app and modules, also for tests)
|
||||
├── canvas.rs # wgpu rendering: paper, patterns, images, ink, neighboring pages
|
||||
├── shader.wgsl # Vertex and fragment shaders
|
||||
├── viewport.rs # Camera (zoom, pan), page stack of the continuous view, swipe momentum
|
||||
|
||||
@@ -15,7 +15,7 @@ ink-notes ist ein einzelnes Programm mit einem Event-Loop (`winit`) im Haupt-Thr
|
||||
| Haupt-Thread | Eingaben, Datenmodell, Rendering (`wgpu`), Oberfläche (`egui`) |
|
||||
| Autosave | Seiten und Manifest auf die Festplatte schreiben (`autosave.rs`) |
|
||||
| PDF-Rendering | Importierte PDF-Seiten zu Texturen rendern (`pdf_doc.rs`, `hayro`) |
|
||||
| Export | PDF/PNG/SVG-Export, damit die Oberfläche nicht hängt (`main.rs`) |
|
||||
| Export | PDF/PNG/SVG-Export, damit die Oberfläche nicht hängt (`app.rs`) |
|
||||
|
||||
Stifteingaben kommen über `octotablet` (Tablet-Protokoll von Wayland bzw. X11), Maus und Touch über `winit`. Die Oberfläche (Werkzeugleiste, Menüs, Dialoge, Textbearbeitung) ist mit `egui` gebaut und wird im selben Render-Durchgang über das Blatt gezeichnet.
|
||||
|
||||
|
||||
@@ -15,7 +15,7 @@ ink-notes is a single program with an event loop (`winit`) on the main thread, p
|
||||
| Main thread | Input, data model, rendering (`wgpu`), interface (`egui`) |
|
||||
| Autosave | Writes pages and manifest to disk (`autosave.rs`) |
|
||||
| PDF rendering | Renders imported PDF pages to textures (`pdf_doc.rs`, `hayro`) |
|
||||
| Export | PDF/PNG/SVG export, so the interface does not freeze (`main.rs`) |
|
||||
| Export | PDF/PNG/SVG export, so the interface does not freeze (`app.rs`) |
|
||||
|
||||
Pen input arrives via `octotablet` (the Wayland or X11 tablet protocol), mouse and touch via `winit`. The interface (toolbar, menus, dialogs, text editing) is built with `egui` and drawn over the page in the same render pass.
|
||||
|
||||
|
||||
+4278
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -156,7 +156,7 @@ mod tests {
|
||||
("file_picker.rs", include_str!("file_picker.rs")),
|
||||
("geometry.rs", include_str!("geometry.rs")),
|
||||
("library.rs", include_str!("library.rs")),
|
||||
("main.rs", include_str!("main.rs")),
|
||||
("app.rs", include_str!("app.rs")),
|
||||
("page_export.rs", include_str!("page_export.rs")),
|
||||
("pdf_doc.rs", include_str!("pdf_doc.rs")),
|
||||
("pdf_merge.rs", include_str!("pdf_merge.rs")),
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
//! ink-notes: Latenzoptimierte Inking-App für Linux.
|
||||
|
||||
pub mod app;
|
||||
pub mod assets;
|
||||
pub mod autosave;
|
||||
pub mod background;
|
||||
|
||||
+3
-4272
File diff suppressed because it is too large.
Load diff
+1
-1
@@ -2385,7 +2385,7 @@ mod tests {
|
||||
create_new_notebook(temp_dir.path(), "Neue Seiten").unwrap();
|
||||
let mut autosave = AutosaveController::new(dir.clone(), Duration::from_secs(60));
|
||||
|
||||
// Wie Taste N in main.rs: neue Seite anhängen, Strich darauf, speichern
|
||||
// Wie Taste N in app.rs: neue Seite anhängen, Strich darauf, speichern
|
||||
notebook.next_page();
|
||||
let idx = notebook.current_page_index;
|
||||
notebook.pages[idx] = page_with_one_stroke(notebook.pages[idx].id, PageBackground::Lined);
|
||||
|
||||
@@ -6133,7 +6133,7 @@ mod tests {
|
||||
const UI_SOURCES: [(&str, &str); 4] = [
|
||||
("ui.rs", include_str!("ui.rs")),
|
||||
("selection.rs", include_str!("selection.rs")),
|
||||
("main.rs", include_str!("main.rs")),
|
||||
("app.rs", include_str!("app.rs")),
|
||||
("file_picker.rs", include_str!("file_picker.rs")),
|
||||
];
|
||||
|
||||
|
||||
Reference in new issue
Block a user