From 272369a4a40cd46123d4741571b6fcc7c6d8c3a8 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 29 Nov 2020 18:42:04 +0100 Subject: Fix unstable module positions --- NEWS | 3 ++- src/CanvasModule.cpp | 7 ++++++- src/Configuration.cpp | 5 ++++- 3 files changed, 12 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index 9221a55..f296268 100644 --- a/NEWS +++ b/NEWS @@ -4,11 +4,12 @@ patchage (1.0.3) unstable; * Add command line option to print version * Fix making and breaking connections with Jack DBus * Fix sample rate with Jack DBus + * Fix unstable module positions * Improve man page * Remove Jack session support * Remove flaky DSP load meter - -- David Robillard Sun, 29 Nov 2020 15:54:01 +0000 + -- David Robillard Sun, 29 Nov 2020 17:41:44 +0000 patchage (1.0.2) stable; diff --git a/src/CanvasModule.cpp b/src/CanvasModule.cpp index c049346..dc0af4e 100644 --- a/src/CanvasModule.cpp +++ b/src/CanvasModule.cpp @@ -115,7 +115,12 @@ CanvasModule::load_location() if (_app->conf().get_module_location(_name, _type, loc)) { move_to(loc.x, loc.y); } else { - move_to(20 + rand() % 640, 20 + rand() % 480); + const double x = 20 + rand() % 640; + const double y = 20 + rand() % 480; + + // Move, then store generated location so it is stable + move_to(x, y); + store_location(x, y); } } diff --git a/src/Configuration.cpp b/src/Configuration.cpp index 6158702..f667b1b 100644 --- a/src/Configuration.cpp +++ b/src/Configuration.cpp @@ -346,9 +346,12 @@ Configuration::save() const ModuleSettings& settings = s.second; if (settings.split) { - if (settings.input_location && settings.output_location) { + if (settings.input_location) { write_module_position( file, name, "input", *settings.input_location); + } + + if (settings.output_location) { write_module_position( file, name, "output", *settings.output_location); } -- cgit v1.2.1