File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -597,16 +597,18 @@ bool IsOnCloseButton(const NodePtr& node, POINT pt) {
597597 bool found = false ;
598598 auto find_hit_button = [&](this auto && self, const NodePtr& child) -> bool {
599599 if (GetAccessibleRole (child) == ROLE_SYSTEM_PUSHBUTTON) {
600- std::optional<std::wstring> acc_name ;
601- GetAccessibleName (child, [&acc_name ](BSTR bstr) {
600+ bool is_close_name = false ;
601+ GetAccessibleName (child, [&is_close_name ](BSTR bstr) {
602602 if (bstr) {
603- acc_name = std::wstring (bstr);
603+ std::wstring_view name_view (bstr);
604+ is_close_name =
605+ (name_view.find (L" Close" ) != std::wstring_view::npos) ||
606+ (name_view.find (L" 关闭" ) != std::wstring_view::npos);
604607 }
605608 });
606609 GetAccessibleSize (child, [&](RECT rect) {
607610 if (PtInRect (&rect, pt)) {
608- if (!acc_name || acc_name->find (L" Close" ) != std::wstring::npos ||
609- acc_name->find (L" 关闭" ) != std::wstring::npos) {
611+ if (is_close_name) {
610612 found = true ;
611613 }
612614 }
You can’t perform that action at this time.
0 commit comments