Skip to content

Commit

Permalink
Deal with a dissapearing cursor on windows (#2028)
Browse files Browse the repository at this point in the history
I was calling spawn_miniedit_text modally inside an already modal
loop so the modal loops unwound improperly in some cases not restoring
cursor. This meant controller name on windows would eat the cursor

Fix it by haing the menu defer the call in a VSTGUI::Call::later

did a quick review and the other spots with miniedit are already
deferred it seems or are called from different parts of the event
loop

Closes #1465
  • Loading branch information
baconpaul authored Jun 4, 2020
1 parent 7382a90 commit 250cc29
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/common/gui/PopupEditorDialog.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ void spawn_miniedit_text(char* c, int maxchars, const char* prompt, const char*
if (me.updated)
{
strncpy(c, me.textdata, maxchars);
c[maxchars-1] = 0;
}
}
#elif LINUX
Expand Down
20 changes: 14 additions & 6 deletions src/common/gui/SurgeGUIEditor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
#include "pluginterfaces/vst/ivstcontextmenu.h"
#include "pluginterfaces/base/ustring.h"

#include "vstgui/lib/cvstguitimer.h"

template< typename T >
struct RememberForgetGuard {
RememberForgetGuard( T *tg )
Expand Down Expand Up @@ -2534,12 +2536,18 @@ int32_t SurgeGUIEditor::controlModifierClicked(CControl* control, CButtonState b
eid++;

addCallbackMenu(contextMenu, "Rename", [this, control, ccid]() {
spawn_miniedit_text(synth->storage.getPatch().CustomControllerLabel[ccid], 16, "Enter a new name for macro controller:", "Rename Macro");
((CModulationSourceButton*)control)
->setlabel(synth->storage.getPatch().CustomControllerLabel[ccid]);
control->setDirty();
control->invalid();
synth->updateDisplay();
VSTGUI::Call::later( [this, control, ccid]() {
spawn_miniedit_text(synth->storage.getPatch().CustomControllerLabel[ccid] , 16,
"Enter a new name for macro controller:", "Rename Macro");

((CModulationSourceButton*)control)
->setlabel(synth->storage.getPatch().CustomControllerLabel[ccid]);

control->setDirty();
control->invalid();
synth->refresh_editor = true;
synth->updateDisplay();
}, 1 );
});
eid++;

Expand Down

0 comments on commit 250cc29

Please sign in to comment.