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

Method ClipboardToSendData

src/WorkerImplement.h:46–96  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

44 TStatus GetClipStringCallback();
45 void ClipboardClearFormat2() { IFS_LOG(m_clipWorker.ClipboardClearFormat()); }
46 void ClipboardToSendData(const std::wstring& clipdata) {
47
48 m_cycleList.Clear();
49
50 HKL layouts[10];
51 int count = GetKeyboardLayoutList(std::ssize(layouts), layouts);
52 if (count == 0) {
53 IFW_LOG(false);
54 return;
55 }
56
57
58 for (auto c : clipdata) {
59 if (c == L'\r')
60 continue;
61 auto lay = CurLay();
62 SHORT res = VkKeyScanEx(c, lay);
63 if (res == -1) {
64 for (int i = 0; i < count; ++i) {
65 if (layouts[i] != lay)
66 res = VkKeyScanEx(c, layouts[i]);
67 if (res != -1)
68 break;
69 }
70 }
71 if (res == -1) {
72 IFS_LOG(SW_ERR_UNKNOWN, L"Cant scan char %c", c);
73 continue;
74 }
75 BYTE mods = HIBYTE(res);
76 BYTE vk_code = LOBYTE(res);
77
78 TKeyType type = KEYTYPE_LETTER;
79 // Пока сделаем супер-простое разделение
80 if (StrUtils::IsSpace(c)) type = KEYTYPE_SPACE;
81
82 TKeyBaseInfo key{
83 .vk_code = vk_code,
84 .scan_code = {},
85 .is_shift = TestFlag(mods, 0x1),
86 .is_caps = m_is_last_caps,
87 .type = type
88 };
89 m_cycleList.AddKeyToList(key);
90 }
91
92 RevertText(hk_RevertAllRecentText, true, true);
93 if (m_clear_alfter_selected) {
94 m_cycleList.Clear();
95 }
96 }
97
98 void RevertText(HotKeyType typeRevert, bool no_backs = false, bool always_full_text = false) {
99 auto nextLng = getNextLang();

Callers

nothing calls this directly

Calls 4

IsSpaceFunction · 0.85
TestFlagFunction · 0.85
AddKeyToListMethod · 0.80
ClearMethod · 0.45

Tested by

no test coverage detected