From d0033204df86451c3ee11cc7d4df45ea09ee9bc8 Mon Sep 17 00:00:00 2001 From: JDonaghy Date: Sat, 27 Jun 2026 21:06:13 -0500 Subject: [PATCH] feat(#539): add dormant impl ShellApp for App (#448-B) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Adds `impl quadraui::ShellApp for App` to src/gtk/mod.rs after the main App impl block. The impl is NOT wired up — it compiles alongside the existing Relm4 path with zero behaviour change. `handle()` structurally matches UiEvent variants (KeyPressed/CharTyped → handle_key_press, mouse events → dispatch_engine_action) with `todo!()` stubs pending the ComponentSender integration in #448-C. `render_content` is also a stub. Also adopts three quadraui API additions that arrived since the last vimcode sync (pre-existing build failures): - Toolbar::focused_index: None (render.rs ×2) - Dialog::table: None (render.rs) - DialogMeasure::table_height: 0.0 (gtk/draw.rs, tui_main/render_impl.rs) - Palette::mode: PaletteMode::List (render.rs, tui_main/render_impl.rs) Co-Authored-By: Claude Sonnet 4.6 --- src/gtk/draw.rs | 1 + src/gtk/mod.rs | 43 +++++++++++++++++++++++++++++++++++++ src/render.rs | 4 ++++ src/tui_main/render_impl.rs | 2 ++ 4 files changed, 50 insertions(+) diff --git a/src/gtk/draw.rs b/src/gtk/draw.rs index 3ca1bedd..50c8669b 100644 --- a/src/gtk/draw.rs +++ b/src/gtk/draw.rs @@ -2127,6 +2127,7 @@ pub(super) fn draw_dialog_popup( button_width: btn_max_w as f32, button_gap: button_gap as f32, padding: padding as f32, + table_height: 0.0, }; let viewport = quadraui::Rect::new(0.0, 0.0, editor_width as f32, editor_height as f32); let dialog_layout = dialog.layout(viewport, measure, |_| { diff --git a/src/gtk/mod.rs b/src/gtk/mod.rs index 61a80e53..a045e971 100644 --- a/src/gtk/mod.rs +++ b/src/gtk/mod.rs @@ -10035,6 +10035,49 @@ impl App { } } +// ── Dormant ShellApp impl (#448-B) ────────────────────────────────────────── +// This impl compiles alongside the Relm4 path but is NOT wired up. +// It will replace the Relm4 update loop in #448-C when the ShellApp runner +// is activated. +impl quadraui::ShellApp for App { + fn render_content( + &self, + _backend: &mut dyn quadraui::Backend, + _layout: &quadraui::AppShellLayout, + ) { + // Will delegate to the Cairo draw pipeline once wired in #448-C. + todo!() + } + + fn handle( + &mut self, + event: quadraui::UiEvent, + _backend: &mut dyn quadraui::Backend, + _ctx: &quadraui::ShellContext<'_>, + ) -> quadraui::Reaction { + // Routes UiEvent variants to the same handlers as the Relm4 update path. + // handle_key_press and dispatch_engine_action both require a + // ComponentSender; the sender integration is deferred to #448-C. + match event { + quadraui::UiEvent::KeyPressed { .. } | quadraui::UiEvent::CharTyped(_) => { + // Delegate to self.handle_key_press(key_name, unicode, ctrl, alt, sender) + // once the ComponentSender is available via the ShellApp runner. + todo!() + } + quadraui::UiEvent::MouseDown { .. } + | quadraui::UiEvent::MouseUp { .. } + | quadraui::UiEvent::MouseMoved { .. } + | quadraui::UiEvent::DoubleClick { .. } + | quadraui::UiEvent::Scroll { .. } => { + // Route through self.dispatch_engine_action(action, sender, false) + // once the ComponentSender is available via the ShellApp runner. + todo!() + } + _ => quadraui::Reaction::Continue, + } + } +} + // view_row_to_buf_line and view_row_to_buf_pos_wrap are now shared functions // in render.rs — use render::view_row_to_buf_line / render::view_row_to_buf_pos_wrap. diff --git a/src/render.rs b/src/render.rs index ed664519..41daec24 100644 --- a/src/render.rs +++ b/src/render.rs @@ -2019,6 +2019,7 @@ pub fn debug_toolbar(engine: &Engine) -> quadraui::Toolbar { session && stopped, ), ], + focused_index: None, } } @@ -3723,6 +3724,7 @@ pub fn dialog_panel_to_quadraui_dialog(panel: &DialogPanel) -> quadraui::Dialog cursor: None, }) }), + table: None, } } @@ -6496,6 +6498,7 @@ pub fn sc_button_toolbar(sc: &SourceControlData) -> quadraui::Toolbar { action(2, "", icons::GIT_PULL.s(), None, true), action(3, "", icons::GIT_SYNC.s(), None, true), ], + focused_index: None, } } @@ -8147,6 +8150,7 @@ pub fn picker_panel_to_palette(picker: &PickerPanel) -> quadraui::Palette { show_query: true, create_label: None, preview, + mode: quadraui::PaletteMode::List, } } diff --git a/src/tui_main/render_impl.rs b/src/tui_main/render_impl.rs index b70938c0..14102df0 100644 --- a/src/tui_main/render_impl.rs +++ b/src/tui_main/render_impl.rs @@ -1032,6 +1032,7 @@ pub(super) fn draw_frame( button_width: capped_btn_w, button_gap: 0.0, padding: 1.0, + table_height: 0.0, }; let layout = q_dialog.layout(viewport, measure, |_| { quadraui::ToolbarItemMeasure::new(0.0) @@ -1148,6 +1149,7 @@ fn folder_picker_to_palette(picker: &FolderPickerState, popup_width: usize) -> q show_query: true, create_label: None, preview: None, + mode: quadraui::PaletteMode::List, } }