MCPcopy Create free account
hub / github.com/WarmUpTill/SceneSwitcher / SendCustomHotkey

Method SendCustomHotkey

plugins/base/macro-action-hotkey.cpp:313–354  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

311}
312
313void MacroActionHotkey::SendCustomHotkey()
314{
315 std::vector<HotkeyType> keys;
316 if (_leftShift) {
317 keys.push_back(HotkeyType::Key_Shift_L);
318 }
319 if (_rightShift) {
320 keys.push_back(HotkeyType::Key_Shift_R);
321 }
322 if (_leftCtrl) {
323 keys.push_back(HotkeyType::Key_Control_L);
324 }
325 if (_rightCtrl) {
326 keys.push_back(HotkeyType::Key_Control_R);
327 }
328 if (_leftAlt) {
329 keys.push_back(HotkeyType::Key_Alt_L);
330 }
331 if (_rightAlt) {
332 keys.push_back(HotkeyType::Key_Alt_R);
333 }
334 if (_leftMeta) {
335 keys.push_back(HotkeyType::Key_Win_L);
336 }
337 if (_rightMeta) {
338 keys.push_back(HotkeyType::Key_Win_R);
339 }
340 if (_key != HotkeyType::Key_NoKey) {
341 keys.push_back(_key);
342 }
343
344 if (!keys.empty()) {
345 int dur = _duration.Milliseconds();
346 if (_onlySendToObs || !CanSimulateKeyPresses()) {
347 std::thread t([keys, dur]() { InjectKeys(keys, dur); });
348 t.detach();
349 } else {
350 std::thread t([keys, dur]() { PressKeys(keys, dur); });
351 t.detach();
352 }
353 }
354}
355
356bool MacroActionHotkey::PerformAction()
357{

Callers

nothing calls this directly

Calls 5

InjectKeysFunction · 0.85
MillisecondsMethod · 0.80
CanSimulateKeyPressesFunction · 0.50
PressKeysFunction · 0.50
emptyMethod · 0.45

Tested by

no test coverage detected