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:
@@ -326,25 +326,9 @@ std::string moduleFileName(HMODULE mod) {
|
||||
}
|
||||
}
|
||||
|
||||
// True iff `path`'s file name (the part after the last separator) case-insensitively matches
|
||||
// `fileName` — Windows paths are case-insensitive, and GetModuleFileName's casing tracks however
|
||||
// the module was loaded (often not the on-disk casing).
|
||||
bool sameBaseName(const std::string& path, const std::string& fileName) {
|
||||
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() != fileName.size()) return false;
|
||||
for (std::size_t i = 0; i < base.size(); ++i) {
|
||||
char a = base[i], b = fileName[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;
|
||||
}
|
||||
|
||||
// This channel's own ReaSampler 9000 module file name (e.g. "reasampler_9000.vst3", or the
|
||||
// "_beta" variant) — the same name CMake gives the built .vst3 (OUTPUT_NAME + SUFFIX), so stable
|
||||
// and beta each recognise only their own binary, never the other channel's.
|
||||
// "_beta" variant) — the same name CMake gives the built .vst3 (OUTPUT_NAME + SUFFIX). Matching
|
||||
// logic lives in core/ui/window_origin's isOwnModulePath; see there.
|
||||
const std::string& ownVstFileName() {
|
||||
static const std::string name = version::vstOutputName() + ".vst3";
|
||||
return name;
|
||||
@@ -385,7 +369,7 @@ ui::WindowFacts windowFacts(HWND hwnd) {
|
||||
// (string-building) lookup in that case.
|
||||
if (!f.hostModule) {
|
||||
f.modulePath = moduleFileName(mod);
|
||||
f.ownModule = sameBaseName(f.modulePath, ownVstFileName());
|
||||
f.ownModule = ui::isOwnModulePath(f.modulePath, ownVstFileName());
|
||||
}
|
||||
return f;
|
||||
}
|
||||
|
||||
@@ -68,9 +68,13 @@ bool pointerOverHostWindow(int screenX, int screenY);
|
||||
// - an all-#32770 dialog-based editor (the generic Windows dialog class) resolves to no
|
||||
// recognizable plugin module — falls to REAPER's outcome;
|
||||
// - a .NET/WPF editor's class procedure is a CLR-thunked address with no resolvable module —
|
||||
// also falls to REAPER's outcome;
|
||||
// also falls to REAPER's outcome; `[verify]`;
|
||||
// - our own ReaSampler 9000 module (this channel's reasampler_9000[_beta].vst3, matched by
|
||||
// basename) also falls to REAPER's outcome, deliberately — see ui::WindowFacts::ownModule.
|
||||
// basename) also falls to REAPER's outcome, deliberately — see ui::WindowFacts::ownModule;
|
||||
// - ReaSampler 9000 itself run bridged/in a separate process reads as Plugin, same as any other
|
||||
// bridged plugin — banner (the OS hand-off fires over our own editor), harmless;
|
||||
// - a renamed ReaSampler 9000 binary (the basename no longer matches ownVstFileName()) misses
|
||||
// the exemption and reads as Plugin — banner, harmless.
|
||||
// The opposite direction is unguarded: a third-party hook that replaces REAPER's own chrome
|
||||
// class procedure via SetClassLongPtr(GCLP_WNDPROC) would make REAPER's own window read as
|
||||
// Plugin — toward OLE instead of away from it.
|
||||
|
||||
Reference in New Issue
Block a user