Skip to content

Commit e4b39db

Browse files
andyclaude
andcommitted
Fix NModeStepCmd's ret=false bug; attempt (unconfirmed) fix for animation radio box not switching (#81)
NModeStepCmd::execute() declared `ret = false` and never set it true on success, unlike ShowFragCmd/NModeTraceCmd -- fixed to match. Found while investigating a report that vibration-mode animation (#81, supposedly fixed by 07e7bf9) still didn't work live; doesn't appear to be the actual cause (Builder::execute() calls refreshRenderArea() unconditionally regardless of a command's return value) but is a real, distinct defect. Live debugging (strace, live screenshots via xdotool, a synced synthetic click) traced the real symptom to something earlier: the Vibrational Frequencies panel's Animation/Vector radio box doesn't deliver its click event under wx3.2/GTK3 here. Confirmed at the syscall level with an instrumented build -- the native GTK widget's selected bullet toggles correctly on click, but NModePanel::OnRadioboxSelected() is never entered, for a real click or a precisely-synced synthetic one. Since the Animation/Vector display switch (row visibility, scene-graph switches) is entirely gated on that event, nothing downstream ever runs. Added NModePanel::OnRadioboxUpdateUI(), bound via EVT_UPDATE_UI, on the theory that wx's idle-time UI-update poll would sidestep whatever GTK signal wiring is failing for the click event specifically. Built, packaged, and live-tested same day: no visible difference. This fix does NOT resolve the reported symptom, or doesn't for the reason assumed. Left in place (harmless, and correct in isolation) with an honest code comment and a CLAUDE.md writeup for the next session, since the diagnostic work (confirming the native event never arrives) is solid and shouldn't need re-deriving, but the fix itself is not. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01N4kYrC9KXyyiUzQrkS8ha3
1 parent 66f6c63 commit e4b39db

4 files changed

Lines changed: 91 additions & 4 deletions

File tree

‎CLAUDE.md‎

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -349,6 +349,44 @@ Both per-user, both non-root, both started automatically by the
349349
that a symptom is this bug rather than a data problem. Fixed with a
350350
pending-redraw flag (`p_redrawPending`) that `OnPaint()` checks and
351351
acts on once the in-flight paint finishes.
352+
- **OPEN, UNRESOLVED (2026-09-17): the Vibrational Frequencies panel's
353+
Animation/Vector radio box doesn't deliver its click event under
354+
wx3.2/GTK3** — confirmed live via strace (syscall-level, a synthetic
355+
click synced exactly with the trace window): the native GTK widget's
356+
own selected bullet toggles correctly, but `NModePanel::
357+
OnRadioboxSelected()` is never entered — zero evidence of it running,
358+
for a real click or a synced synthetic one. This is *not* the same
359+
bug as the `p_isValid`/`CreateGrid()` construction-ordering issue
360+
above (which is fixed) — this is later, after the panel is fully
361+
built and idle, on an ordinary click. Symptom: switching the radio
362+
does nothing (no row swap, no vector-arrows/animate-mode switch,
363+
Play button never appears) since the whole display-mode switch is
364+
gated on that event firing. An `EVT_UPDATE_UI`-based idle-poll
365+
workaround was added (`NModePanel::OnRadioboxUpdateUI`, compares
366+
`radbox->GetSelection()` each idle tick against a cached
367+
`p_lastRadioSel`) on the theory that this sidesteps whatever GTK
368+
signal wiring is failing for the click event specifically. Built,
369+
packaged, and live-tested same day — **no visible difference**, so
370+
this fix does not actually work, or doesn't work for the reason
371+
assumed. Don't trust the code comment above `OnRadioboxUpdateUI()`
372+
to mean this is fixed — re-verify live before believing it. Next
373+
session should treat the "native event never fires" diagnosis as
374+
solid (already re-derived twice, syscall-level) but budget fresh
375+
investigation for *why* the workaround didn't help — candidates not
376+
yet ruled out: whether `EVT_UPDATE_UI` is actually reaching this
377+
window at all (same category of failure as the click event, would
378+
need its own strace/instrumented-build check), whether
379+
`showAnimationMode()`/`showVectorMode()` are even the code path
380+
actually driving what's visible in the panel (unverified assumption
381+
going in), or a packaging/install mismatch (binary in the `.deb`
382+
not matching what was last built — check md5sum/mtime of
383+
`/opt/ecce/bin/builder` against `build-cmake/builder` before
384+
re-testing anything, this bit a previous round in the same session).
385+
This also blocks separately verifying whether `NModeStepCmd`'s
386+
redraw fix (`07e7bf9` plus this session's `ret=true` correction)
387+
actually animates once display-mode switching works at all — that
388+
is *still unverified end-to-end* despite the code-level trace in
389+
`NModeStepCmd.C`/`Builder::execute()` looking sound.
352390

353391
## Where the history lives
354392
This file used to be a session-by-session diary and grew to ~2500 lines.

‎src/apps/builder/NModePanel.C‎

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ BEGIN_EVENT_TABLE( NModePanel, NModesGUI )
6262
EVT_GRID_SELECT_CELL(NModePanel::OnModeSelection)
6363

6464
EVT_RADIOBOX( ID_RADIOBOX_NMODE_VIZTYPE, NModePanel::OnRadioboxSelected )
65+
EVT_UPDATE_UI( ID_RADIOBOX_NMODE_VIZTYPE, NModePanel::OnRadioboxUpdateUI )
6566
EVT_TIMER(wxID_ANY, NModePanel::OnTimer)
6667
EVT_PLOTCTRL_CLICKED(wxID_ANY, NModePanel::OnPlotClick)
6768
EVT_PLOTCTRL_POINT_CLICKED(wxID_ANY, NModePanel::OnPointClick)
@@ -84,7 +85,8 @@ NModePanel::NModePanel()
8485
p_currentStep(0),
8586
p_mode(0),
8687
p_numAnimations(0),
87-
p_isValid(false)
88+
p_isValid(false),
89+
p_lastRadioSel(-1)
8890
{
8991
p_vecAmplitude = 1.0;
9092
p_aniAmplitude = 1.0;
@@ -105,7 +107,8 @@ NModePanel::NModePanel(IPropCalculation *calculation,
105107
p_currentStep(0),
106108
p_mode(0),
107109
p_numAnimations(0),
108-
p_isValid(false)
110+
p_isValid(false),
111+
p_lastRadioSel(-1)
109112
{
110113
Create(calculation, parent, id, pos, size, style, name);
111114
p_vecAmplitude = 1.0;
@@ -701,7 +704,8 @@ void NModePanel::OnSliderTextEnter(wxCommandEvent& event)
701704
void NModePanel::receiveFocus()
702705
{
703706
wxRadioBox *radbox = (wxRadioBox*)FindWindow(ID_RADIOBOX_NMODE_VIZTYPE);
704-
if (radbox->GetSelection() == 0) {
707+
p_lastRadioSel = radbox->GetSelection();
708+
if (p_lastRadioSel == 0) {
705709
showAnimationMode();
706710
} else {
707711
showVectorMode();
@@ -779,15 +783,56 @@ void NModePanel::OnCheckboxNmodeVecsignClick( wxCommandEvent& event )
779783
void NModePanel::OnRadioboxSelected( wxCommandEvent& event )
780784
{
781785
wxRadioBox *radbox = (wxRadioBox*)FindWindow(ID_RADIOBOX_NMODE_VIZTYPE);
786+
p_lastRadioSel = radbox->GetSelection();
782787
setSlider();
783-
if (radbox->GetSelection() == 0) {
788+
if (p_lastRadioSel == 0) {
784789
showAnimationMode();
785790
} else {
786791
showVectorMode();
787792
}
788793
event.Skip();
789794
}
790795

796+
/**
797+
* Confirmed live (strace on an instrumented build, synthetic click
798+
* synced with the trace window): clicking the Animation/Vector radio
799+
* box toggles the native GTK widget's own selected bullet, but
800+
* OnRadioboxSelected() below is never entered -- zero writes from any
801+
* of its instrumented call sites, for either the real click or a
802+
* synced synthetic one. wxEVT_COMMAND_RADIOBOX_SELECTED is not
803+
* reaching this object under wx3.2/GTK3 for this control.
804+
*
805+
* This handler was added as a suspected fix: EVT_UPDATE_UI is a
806+
* wx-level idle-time poll, independent of whatever GTK signal wiring
807+
* is failing for the click event, so in theory it should still detect
808+
* radbox->GetSelection() changing even when the native event doesn't
809+
* arrive. Built, packaged, and live-tested (2026-09-17) -- no visible
810+
* difference; the Animation/Vector display still doesn't switch. That
811+
* means either this EVT_UPDATE_UI handler also isn't firing for this
812+
* control, or the display-switch code path itself (showAnimationMode/
813+
* showVectorMode) isn't the actual mechanism behind what's visible in
814+
* the panel, or the installed package still wasn't picking up this
815+
* binary for some reason not yet ruled out. Not root-caused. Next
816+
* session: don't assume this fix works, and don't re-spend time
817+
* re-deriving the "native event never arrives" fact above -- it's
818+
* solid (syscall-level trace, synced click) -- but treat the
819+
* EVT_UPDATE_UI theory and everything below it as unverified.
820+
*/
821+
void NModePanel::OnRadioboxUpdateUI( wxUpdateUIEvent& event )
822+
{
823+
wxRadioBox *radbox = (wxRadioBox*)FindWindow(ID_RADIOBOX_NMODE_VIZTYPE);
824+
int sel = radbox->GetSelection();
825+
if (sel != p_lastRadioSel) {
826+
p_lastRadioSel = sel;
827+
setSlider();
828+
if (sel == 0) {
829+
showAnimationMode();
830+
} else {
831+
showVectorMode();
832+
}
833+
}
834+
}
835+
791836
void NModePanel::OnModeSelection( wxGridEvent& event )
792837
{
793838
// wxGrid::CreateGrid() (NModesGUI::CreateControls(), building the

‎src/apps/builder/NModePanel.H‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,7 @@ class NModePanel : public NModesGUI,
7979
void OnEndSliderMotion(wxScrollEvent& event);
8080
void OnSliderTextEnter(wxCommandEvent& event);
8181
void OnRadioboxSelected( wxCommandEvent& event );
82+
void OnRadioboxUpdateUI( wxUpdateUIEvent& event );
8283
void OnModeSelection( wxGridEvent& event );
8384
void OnCheckboxNmodeVecsignClick( wxCommandEvent& event );
8485
void OnTimer( wxTimerEvent& event );
@@ -104,6 +105,7 @@ class NModePanel : public NModesGUI,
104105
int p_mode;
105106
int p_numAnimations;
106107
bool p_isValid;
108+
int p_lastRadioSel;
107109
float p_vecAmplitude; // varies for vector vs animation
108110
float p_aniAmplitude; // varies for vector vs animation
109111

‎src/viz/propsgcommands/NModeStepCmd.C‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,8 @@ bool NModeStepCmd::execute()
7171

7272
if (nmtrace) {
7373

74+
ret = true;
75+
7476
int table = 0 ; // we only have one table
7577

7678
// reset the coordinates in the fragment for each atom

0 commit comments

Comments
 (0)