Fix Stop button with fullscreen experiments on Windows - #43
Open
SherlockChiang wants to merge 1 commit into
Open
Fix Stop button with fullscreen experiments on Windows#43SherlockChiang wants to merge 1 commit into
SherlockChiang wants to merge 1 commit into
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes psychopy/psychopy#7693.
Problem
On Windows, switching focus away from a fullscreen experiment can interrupt the Stop button click before wx emits
EVT_BUTTON. The button visibly enters its pressed state, but the existing callback is not invoked and the experiment continues running.During reproduction with an active fullscreen PsychoPy window,
EVT_LEFT_DOWNwas received butEVT_BUTTONwas not.Change
Bind the Runner Python Stop button to
EVT_LEFT_DOWNon Windows so the existingstopTask()command runs before a fullscreen focus change can interrupt the click.The button is disabled before calling
stopTask()to prevent the corresponding mouse-up from invoking the command a second time. The existingEVT_BUTTONbinding remains in place for keyboard activation and for other platforms.This does not change
Job,Popen.kill(), or process-tree termination behavior. Runner and experiments launched from Coder share this Stop path.Automated tests
Environment:
dev/ 2026.2 atceafbd09a741efd81b83cd39acb3a86df6e53fc1psychopy-appdevCommand:
Result:
The new unit test verifies that the Stop button is disabled before
stopTask()is called, preventing re-entry while termination yields to the wx event loop. The existing app smoke test launches Builder, Runner, and Coder.Additional checks:
Both completed successfully.
Windows end-to-end test flow
Jobpath used by Runner.visual.Windowand continuously callwin.flip().fullscr=Falseand once withfullscr=True.wx.UIActionSimulatorto issue a real mouse-down and mouse-up over Stop.EVT_LEFT_DOWNthroughRunnerRibbon._stopOnMouseDown().EVT_LEFT_DOWN,EVT_BUTTON, the managed process state, and remaining processes.Windowed result:
Fullscreen result:
In both modes the submitted handler ran, the experiment stopped, and no experiment process remained. The fullscreen result also reproduces the event-level cause: the mouse-down event arrives while the normal button event does not.