Skip to content

Commit

Permalink
TwoStateQuery(): Add workaround for broken Matlab R2024a on Apple Sil…
Browse files Browse the repository at this point in the history
…icon macOS.

questdlg() is broken on at least R2024a Apple Silicon macOS. Sometimes it works, but most often if one
clicks on a dialog button, Matlab hangs in the spinning beach ball of death. No such problem with Matlab
on Linux, or with Octave on macOS.

Fall back to ugly figure() method for Matlab on macOS ARM for the time being.
  • Loading branch information
kleinerm committed Jun 3, 2024
1 parent 2623810 commit a0d0fae
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Psychtoolbox/PsychHardware/Daq/Utilities/TwoStateQuery.m
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,10 @@
% MK: Always use this one, even on Matlab. I can not see the advantage of
% the Matlab specific contraption below? It seems to provide the same
% functionality, but with way more ugly formatting?
if IsOctave || 1
% Except on Matlab for macOS on Apple Silicon, where questdlg() is broken
% as of R2024a - Half of the time it works, the other half clicking on a
% button causes Matlab to hang with the spinning beach ball of death.
if IsOctave || ~(IsOSX && IsARM)
button = questdlg(TheQuestion, 'Question', TheChoices{1}, TheChoices{2}, 'Cancel', 'Cancel');
if ~isempty(strfind(button, TheChoices{1}))
UserResponse = 1;
Expand All @@ -91,7 +94,7 @@
PrimeFontSize = 36;

QueryFigh = figure('Position',[FigPos FigWidth FigHeight],'Resize','off','NumberTitle','off', ...
'Name','Cross the Rubicon','MenuBar','none','Color','k');
'Name','Question','MenuBar','none','Color','k');
QueryFighNr = QueryFigh;
if ~isnumeric(QueryFighNr)
QueryFighNr = QueryFigh.Number;
Expand Down

0 comments on commit a0d0fae

Please sign in to comment.