Skip to content

Commit 25178a3

Browse files
committed
Make the OSARA send context menu in the I/O Routing window expose the checked/unchecked state of toggles such as mute and mono.
This only works in REAPER 7.11 and later, as this information wasn't exposed to MSAA prior to that. In earlier versions, the checked/unchecked state won't be exposed, as was always previously the case.
1 parent fac79a1 commit 25178a3

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/reaper_osara.cpp

+14-3
Original file line numberDiff line numberDiff line change
@@ -2546,8 +2546,6 @@ void sendMenu(HWND sendWindow) {
25462546
HMENU menu = CreatePopupMenu();
25472547
MENUITEMINFO itemInfo;
25482548
itemInfo.cbSize = sizeof(MENUITEMINFO);
2549-
// MIIM_TYPE is deprecated, but win32_utf8 still relies on it.
2550-
itemInfo.fMask = MIIM_TYPE | MIIM_ID;
25512549
itemInfo.fType = MFT_STRING;
25522550
child.vt = VT_I4;
25532551
int item = 0;
@@ -2556,8 +2554,21 @@ void sendMenu(HWND sendWindow) {
25562554
VARIANT role;
25572555
if (acc->get_accRole(child, &role) != S_OK || role.vt != VT_I4)
25582556
continue;
2559-
if (role.lVal != ROLE_SYSTEM_PUSHBUTTON && role.lVal != ROLE_SYSTEM_COMBOBOX)
2557+
// MIIM_TYPE is deprecated, but win32_utf8 still relies on it.
2558+
itemInfo.fMask = MIIM_TYPE | MIIM_ID;
2559+
if (role.lVal == ROLE_SYSTEM_CHECKBUTTON) {
2560+
itemInfo.fMask |= MIIM_STATE;
2561+
VARIANT state;
2562+
if (acc->get_accState(child, &state) == S_OK && state.vt == VT_I4 &&
2563+
state.lVal & STATE_SYSTEM_CHECKED) {
2564+
itemInfo.fState = MFS_CHECKED;
2565+
} else {
2566+
itemInfo.fState = MFS_UNCHECKED;
2567+
}
2568+
} else if (role.lVal != ROLE_SYSTEM_PUSHBUTTON &&
2569+
role.lVal != ROLE_SYSTEM_COMBOBOX) {
25602570
continue;
2571+
}
25612572
BSTR name = NULL;
25622573
if (acc->get_accName(child, &name) != S_OK || !name)
25632574
continue;

0 commit comments

Comments
 (0)