fix: toggle panel once after Alt+D docker hide — derive visibility from IsWindowVisible, not stale g_panel.open flag

This commit is contained in:
2026-07-27 00:51:33 -04:00
parent f250dd0a62
commit c37419beb9
+16 -2
View File
@@ -2850,15 +2850,29 @@ void bankPanelInit(ReaSamplerSession* session) {
g_panel.session = session;
}
// Returns true only when the panel window is actually visible to the user right now.
// IsWindowVisible() returns false when the docker is hidden via Alt+D even though the
// HWND and g_panel.open are still live — the live query is the source of truth for
// toggle decisions and the Actions-list checkmark (OnToggleAction in main.cpp).
static bool panelEffectivelyVisible() {
return g_panel.hwnd && IsWindowVisible(g_panel.hwnd);
}
void bankPanelToggle() {
if (g_panel.open)
// Decide from live visibility, not the cached g_panel.open flag.
// Alt+D hides the docker without destroying the window, leaving g_panel.open
// stale (true) while the panel is gone. Using IsWindowVisible avoids the
// double-fire needed to re-show the panel after a docker hide.
if (panelEffectivelyVisible())
closePanel();
else
openPanel();
}
bool bankPanelIsOpen() {
return g_panel.open;
// Derive from live window state so the Actions-list checkmark stays honest
// even after Alt+D hides the docker without notifying the extension.
return panelEffectivelyVisible();
}
std::vector<std::string> bankPanelSelectedSampleIds() {