Skip to content

Commit

Permalink
refactor: replace __int64 with int of GetTabCount
Browse files Browse the repository at this point in the history
  • Loading branch information
Bush2021 committed May 7, 2024
1 parent 30b9594 commit bc503cf
Showing 1 changed file with 11 additions and 9 deletions.
20 changes: 11 additions & 9 deletions src/iaccessible.h
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ NodePtr GetMenuBarPane(HWND hwnd) {
}

// Gets the current number of tabs.
__int64 GetTabCount(NodePtr top) {
int GetTabCount(NodePtr top) {
NodePtr page_tab_list = FindElementWithRole(top, ROLE_SYSTEM_PAGETABLIST);
if (!page_tab_list) {
return 0;
Expand All @@ -264,14 +264,16 @@ __int64 GetTabCount(NodePtr top) {
return false;
});

auto tab_count =
std::count_if(children.begin(), children.end(), [](NodePtr child) {
auto role = GetAccessibleRole(child);
auto state = GetAccessibleState(child);
return role == ROLE_SYSTEM_PAGETAB ||
(role == ROLE_SYSTEM_PAGETABLIST &&
(state & STATE_SYSTEM_COLLAPSED));
});
int tab_count = 0;
for (const auto& child : children) {
auto role = GetAccessibleRole(child);
auto state = GetAccessibleState(child);
if (role == ROLE_SYSTEM_PAGETAB ||
// Grouped and collapsed tabs are counted as one tab.
(role == ROLE_SYSTEM_PAGETABLIST && (state & STATE_SYSTEM_COLLAPSED))) {
++tab_count;
}
}

return tab_count;
}
Expand Down

0 comments on commit bc503cf

Please sign in to comment.