Skip to content

Commit ee33ca8

Browse files
authored
Merge pull request #14 from nut-tree/fix/12/hanging-shift-key
Fix/12/hanging shift key
2 parents 21cf4a5 + 3ad9110 commit ee33ca8

File tree

3 files changed

+14
-2
lines changed

3 files changed

+14
-2
lines changed

src/keypress.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,12 @@ void win32KeyEvent(int key, MMKeyFlags flags)
102102
scan |= 0x80;
103103
}
104104

105-
keybd_event(key, scan, flags, 0);
105+
INPUT keyboardInput;
106+
keyboardInput.type = INPUT_KEYBOARD;
107+
keyboardInput.ki.wScan = scan;
108+
keyboardInput.ki.dwFlags = KEYEVENTF_SCANCODE | flags;
109+
keyboardInput.ki.time = 0;
110+
SendInput(1, &keyboardInput, sizeof(keyboardInput));
106111
}
107112
#endif
108113

src/mouse.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,14 @@ void toggleMouse(bool down, MMMouseButton button)
201201
XTestFakeButtonEvent(display, button, down ? True : False, CurrentTime);
202202
XSync(display, false);
203203
#elif defined(IS_WINDOWS)
204-
mouse_event(MMMouseToMEventF(down, button), 0, 0, 0, 0);
204+
INPUT mouseInput;
205+
mouseInput.type = INPUT_MOUSE;
206+
mouseInput.mi.mouseData = 0;
207+
mouseInput.mi.dx = 0;
208+
mouseInput.mi.dy = 0;
209+
mouseInput.mi.time = 0;
210+
mouseInput.mi.dwFlags = MMMouseToMEventF(down, button);
211+
SendInput(1, &mouseInput, sizeof(mouseInput));
205212
#endif
206213
}
207214

src/screen.c

100755100644
File mode changed.

0 commit comments

Comments
 (0)