Skip to content

Commit 701375f

Browse files
committed
Fix an issue where combined buttons are ignored
1 parent 1d8ac1e commit 701375f

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

Sajtkukac/Sajtkukac.cpp

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,13 +49,29 @@ static BSTR g_bstrs[3] = {
4949

5050
HRESULT GetWidthOfChildren(BOOL vertical, IUIAutomationElement *taskList, UINT &result)
5151
{
52-
CComPtr<IUIAutomationCondition> buttonCond;
53-
CHK_HR(g_pUI->CreatePropertyCondition(UIA_ControlTypePropertyId,
54-
CComVariant{ UIA_ButtonControlTypeId }, &buttonCond));
52+
static const long buttonVariants[] = {
53+
UIA_ButtonControlTypeId,
54+
UIA_MenuItemControlTypeId
55+
};
56+
57+
IUIAutomationCondition* conditions[2]{ nullptr, nullptr };
58+
SCOPE_EXIT{ for (int i = 0; i < 2; ++i) RELEASE(conditions[i]); };
59+
for (int i = 0; i < 2; ++i)
60+
{
61+
Z_PTR(IUIAutomationCondition, prop);
62+
CHK_HR(g_pUI->CreatePropertyCondition(
63+
UIA_ControlTypePropertyId, CComVariant{ buttonVariants[i] },
64+
&prop));
65+
conditions[i] = prop;
66+
}
67+
68+
CComPtr<IUIAutomationCondition> orCondition;
69+
CHK_HR(g_pUI->CreateOrConditionFromNativeArray(
70+
conditions, 2, &orCondition));
5571

5672
CComPtr<IUIAutomationElementArray> children;
5773
CHK_HR(taskList->FindAll(TreeScope_Children,
58-
buttonCond, &children));
74+
orCondition, &children));
5975

6076
INT length;
6177
CHK_HR(children->get_Length(&length));

Sajtkukac/Sajtkukac.rc

0 Bytes
Binary file not shown.

Sajtkukac/main.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ UINT uPercentage; // position of the icons
4141
UINT uRefreshRate; // refresh rate in milliseconds
4242
UINT uEasingIdx; // index of the easing function
4343
PWORKER_DETAILS wdDetails = nullptr; // struct to communicate with worker
44-
UINT uMajor = 0, uMinor = 5; // current version
44+
UINT uMajor = 0, uMinor = 6; // current version
4545

4646
// TODO: fall back to system icons until someone makes one :)
4747
#ifndef IDI_SAJTKUKAC

0 commit comments

Comments
 (0)