-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Removed sendAltPress stuff because it borks if I drag multiple times …
…without releasing Alt.
- Loading branch information
Showing
2 changed files
with
0 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,32 +1 @@ | ||
#include "dragworker.hpp" | ||
|
||
DragWorker::~DragWorker() { | ||
sendAltPress(); | ||
} | ||
|
||
void DragWorker::sendAltPress() { | ||
// Figure out which Alt key is down. | ||
WORD key; | ||
if (GetAsyncKeyState(VK_LMENU) & 0x8000) { | ||
key = VK_LMENU; | ||
} else if (GetAsyncKeyState(VK_RMENU) & 0x8000) { | ||
key = VK_RMENU; | ||
} else { | ||
key = VK_MENU; | ||
} | ||
|
||
// This is called in a situation where the physical Alt key is actually down, | ||
// so we send a release event first, then a repress event. | ||
// The physical release of Alt will match up with our simulated repress. | ||
// That will hopefully lead to the smallest number of confused apps. | ||
INPUT inputs[2]; | ||
for (int i = 0; i < 2; ++i) { | ||
inputs[i].type = INPUT_KEYBOARD; | ||
inputs[i].ki.wVk = VK_MENU; | ||
inputs[i].ki.dwFlags = 0; | ||
inputs[i].ki.time = 0; | ||
inputs[i].ki.dwExtraInfo = 0; | ||
} | ||
inputs[0].ki.dwFlags |= KEYEVENTF_KEYUP; | ||
SendInput(2, inputs, sizeof(INPUT)); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters