Add Ctrl+Shift+V shortcut on Windows. Fix #333

This commit is contained in:
Federico Terzi 2020-06-24 21:44:29 +02:00
parent 889e2b8f8c
commit 0cd245153f
4 changed files with 41 additions and 0 deletions

View File

@ -566,6 +566,38 @@ void send_multi_vkey_with_delay(int32_t vk, int32_t count, int32_t delay) {
}
}
void trigger_shift_paste() {
std::vector<INPUT> vec;
INPUT input = { 0 };
input.type = INPUT_KEYBOARD;
input.ki.wScan = 0;
input.ki.time = 0;
input.ki.dwExtraInfo = 0;
input.ki.wVk = VK_CONTROL;
input.ki.dwFlags = 0; // 0 for key press
vec.push_back(input);
input.ki.wVk = VK_SHIFT; // SHIFT KEY
vec.push_back(input);
input.ki.wVk = 0x56; // V KEY
vec.push_back(input);
input.ki.dwFlags = KEYEVENTF_KEYUP; // KEYEVENTF_KEYUP for key release
vec.push_back(input);
input.ki.wVk = VK_SHIFT; // SHIFT KEY
vec.push_back(input);
input.ki.wVk = VK_CONTROL;
vec.push_back(input);
SendInput(vec.size(), vec.data(), sizeof(INPUT));
}
void trigger_paste() {
std::vector<INPUT> vec;

View File

@ -87,6 +87,11 @@ extern "C" void delete_string(int32_t count, int32_t delay);
*/
extern "C" void trigger_paste();
/*
* Send the Paste keyboard shortcut (CTRL+SHIFT+V)
*/
extern "C" void trigger_shift_paste();
/*
* Send the copy keyboard shortcut (CTRL+C)
*/

View File

@ -65,6 +65,7 @@ extern "C" {
pub fn send_multi_vkey(vk: i32, count: i32);
pub fn delete_string(count: i32, delay: i32);
pub fn trigger_paste();
pub fn trigger_shift_paste();
pub fn trigger_copy();
// PROCESSES

View File

@ -51,6 +51,9 @@ impl super::KeyboardManager for WindowsKeyboardManager {
trigger_paste();
}
},
PasteShortcut::CtrlShiftV => {
trigger_shift_paste();
},
_ => {
error!("Windows backend does not support this Paste Shortcut, please open an issue on GitHub if you need it.")
}