Skip to content

fix: keep the Start/Stop button in sync with the detector state - #34

Open
leiteszeke wants to merge 1 commit into
HichTala:masterfrom
leiteszeke:up/08-start-button
Open

leiteszeke wants to merge 1 commit into
HichTala:masterfrom
leiteszeke:up/08-start-button

Conversation

@leiteszeke

Copy link
Copy Markdown
Contributor

Summary

draw_source_update() reset the dock's Start button on every source update. As a result:

  • changing any Draw Display setting while detecting relabelled the running Stop button as Start DRAW;
  • it re-enabled the button while detectors were still starting;
  • with input preview on, it disabled the button, so detection could not be stopped;
  • with two sources (two-player mode), whichever source updated last decided the button state.

Changes

  • src/bridge.{h,cpp} — draw_dock_set_button_enabled(bool) → draw_dock_set_preview(source, active): each source reports its own preview state.
  • src/DrawDock.{cpp,hpp} — the dock keeps the set of sources that are previewing. RefreshStartButton() disables Start only while some source is previewing, and leaves the button alone while detectors are starting or running (button checked), so it can always be used to stop them.
  • src/draw.c — reports per source, and clears it when the source is destroyed (a deleted source can't leave the button stuck disabled).

No behaviour change when nothing is detecting: preview on → button shows Preview in progress and is disabled, preview off → Start DRAW.

How it was tested

  • Plugin build succeeds (cmake --preset macos), tests pass (ctest).
  • Tested in OBS 32.1.1 (macOS), two Draw Display sources on one image input:
    • one source previewing → Preview in progress, disabled; adding a second, non-previewing source keeps it disabled (before: the last update re-enabled it);
    • both previews off → Start DRAW; deleting the only previewing source → Start DRAW again;
    • Start → Starting DRAW... (disabled); changing a source setting while starting keeps it (before: relabelled Start DRAW and re-enabled);
    • running → Stop DRAW; changing a setting or turning the preview on while running keeps Stop DRAW, enabled (before: disabled, detection could not be stopped);
    • Stop with the preview on → Preview in progress, disabled; preview off → Start DRAW.

draw_source_update() reset the dock button on every source update, so
changing a source setting while detecting relabelled the running Stop
button as "Start DRAW", re-enabled it while detectors were still
starting, and with the input preview on disabled it so detection could
not be stopped. With two sources, whichever updated last won.

Each source now reports its own preview state; the dock disables Start
only while some source is previewing and leaves the button alone while
detectors are starting or running.
@HichTala
HichTala self-requested a review October 15, 2026 13:56
@HichTala HichTala added the bug Something isn't working label Oct 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants