Skip to content

Commit

Permalink
Removed sendAltPress stuff because it borks if I drag multiple times …
Browse files Browse the repository at this point in the history
…without releasing Alt.
  • Loading branch information
ttencate committed Jan 14, 2010
1 parent f5d85f4 commit 2daabe2
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 37 deletions.
31 changes: 0 additions & 31 deletions src/dragworker.cpp
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));
}
6 changes: 0 additions & 6 deletions src/dragworker.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,8 @@ class DragWorker {

public:

virtual ~DragWorker();

virtual void move(POINT const &mousePos) = 0;

private:

void sendAltPress();

};

#endif

0 comments on commit 2daabe2

Please sign in to comment.