MCPcopy Create free account
hub / github.com/Aegel5/SimpleSwitcher / FixCtrlAlt

Method FixCtrlAlt

src/WorkerImplement.cpp:590–639  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

588}
589
590TStatus WorkerImplement::FixCtrlAlt(CHotKey key) {
591
592 IFS_RET(AnalizeTopWnd());
593
594 GETCONF;
595
596 auto lay = cfg->fixRAlt_lay_;
597 auto curLay = CurLay();
598
599 HKL temp = 0;
600 bool just_send = false;
601
602 if (cfg->layouts_info.GetLayoutInfo(lay) == nullptr) {
603 auto str = std::format(L"{:x}", (size_t)lay);
604 //const TChar* s = L"00000409";
605 LOG_ANY(L"load temp layout {}", str);
606 temp = LoadKeyboardLayout(str.c_str(), KLF_ACTIVATE);
607 IFW_LOG(temp != NULL);
608
609 if (temp == 0) {
610 // не получится...
611 just_send = true;
612 }
613 else {
614 Utils::SetLayPost(topWndInfo2.hwnd_default, temp);
615 }
616
617 }
618 else {
619 SetNewLay(lay);
620 }
621
622 WaitOtherLay(curLay);
623
624 // отправляем
625 InputSender::SendHotKey(key);
626
627 if (!just_send) {
628 // переключаемся обратно.
629 Sleep(200);
630 SetNewLay(curLay);
631 }
632
633 if (temp != 0) {
634 LOG_ANY(L"unload temp layout");
635 IFW_LOG(UnloadKeyboardLayout(temp));
636 }
637
638 RETURN_SUCCESS;
639}
640
641
642

Callers

nothing calls this directly

Calls 3

SetLayPostFunction · 0.85
GetLayoutInfoMethod · 0.80
c_strMethod · 0.80

Tested by

no test coverage detected