Skip to content

Commit

Permalink
Make the OSARA send context menu in the I/O Routing window expose the…
Browse files Browse the repository at this point in the history
… 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.
  • Loading branch information
jcsteh committed Feb 13, 2024
1 parent fac79a1 commit 04733ad
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions src/reaper_osara.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2546,8 +2546,6 @@ void sendMenu(HWND sendWindow) {
HMENU menu = CreatePopupMenu();
MENUITEMINFO itemInfo;
itemInfo.cbSize = sizeof(MENUITEMINFO);
// MIIM_TYPE is deprecated, but win32_utf8 still relies on it.
itemInfo.fMask = MIIM_TYPE | MIIM_ID;
itemInfo.fType = MFT_STRING;
child.vt = VT_I4;
int item = 0;
Expand All @@ -2556,8 +2554,21 @@ void sendMenu(HWND sendWindow) {
VARIANT role;
if (acc->get_accRole(child, &role) != S_OK || role.vt != VT_I4)
continue;
if (role.lVal != ROLE_SYSTEM_PUSHBUTTON && role.lVal != ROLE_SYSTEM_COMBOBOX)
// MIIM_TYPE is deprecated, but win32_utf8 still relies on it.
itemInfo.fMask = MIIM_TYPE | MIIM_ID;
if (role.lVal == ROLE_SYSTEM_CHECKBUTTON) {
itemInfo.fMask |= MIIM_STATE;
VARIANT state;
if (acc->get_accState(child, &state) == S_OK && role.vt == VT_I4 &&
state.lVal & STATE_SYSTEM_CHECKED) {
itemInfo.fState = MFS_CHECKED;
} else {
itemInfo.fState = MFS_UNCHECKED;
}
} else if (role.lVal != ROLE_SYSTEM_PUSHBUTTON &&
role.lVal != ROLE_SYSTEM_COMBOBOX) {
continue;
}
BSTR name = NULL;
if (acc->get_accName(child, &name) != S_OK || !name)
continue;
Expand Down

0 comments on commit 04733ad

Please sign in to comment.