Fix SWELL drag guard, channel-fork the VST editor window class, dedupe own-module match

Panel drag no longer misfires on SWELL's always-zero wParam; stable/beta VST editors register distinct window classes against their own module instead of colliding on REAPER's; own-module basename matching moves to a tested pure helper.
This commit is contained in:
2026-09-25 14:11:22 -04:00
parent fee941a83d
commit faa513cafb
10 changed files with 103 additions and 38 deletions
+13
View File
@@ -46,4 +46,17 @@ bool isPluginEditorChain(const std::vector<WindowCode>& chain) {
return std::find(chain.begin(), chain.end(), WindowCode::Plugin) != chain.end();
}
bool isOwnModulePath(const std::string& path, const std::string& ownName) {
const std::size_t pos = path.find_last_of("\\/");
const std::string base = pos == std::string::npos ? path : path.substr(pos + 1);
if (base.size() != ownName.size()) return false;
for (std::size_t i = 0; i < base.size(); ++i) {
char a = base[i], b = ownName[i];
if (a >= 'A' && a <= 'Z') a = static_cast<char>(a - 'A' + 'a');
if (b >= 'A' && b <= 'Z') b = static_cast<char>(b - 'A' + 'a');
if (a != b) return false;
}
return true;
}
} // namespace reasampler::ui
+7 -4
View File
@@ -24,10 +24,8 @@ struct WindowFacts {
bool otherProcess = false; // the window belongs to a process other than the host's
bool procResolved = false; // the class procedure lies inside a loaded module
bool hostModule = false; // ...and that module is the host executable
// ...and that module is THIS channel's ReaSampler 9000 .vst3 (basename match, set by the
// shell against app_version::vstOutputName() + ".vst3" — stable and beta each recognise only
// their own binary, never the other channel's). A drag over our own instrument's editor is
// the load-bearing-principle instrument-drop outcome, not the OS hand-off other plugins get.
// ...and that module is THIS channel's ReaSampler 9000 .vst3. Rationale: core/ui/CLAUDE.md's
// window_origin entry (the ownModule/Instrument exemption).
bool ownModule = false;
std::string modulePath; // that module's file path, UTF-8
};
@@ -43,4 +41,9 @@ WindowCode classifyWindowCode(const WindowFacts& facts, const std::string& syste
// proof — the hand-off this gates is modal, so it needs positive evidence.
bool isPluginEditorChain(const std::vector<WindowCode>& chain);
// True iff `path`'s file name (the part after the last separator, forward or back) matches
// `ownName` case-insensitively — see WindowFacts::ownModule for why this decides Instrument vs
// Plugin. `path` may be a bundle path (only the final component is compared).
bool isOwnModulePath(const std::string& path, const std::string& ownName);
} // namespace reasampler::ui