[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] master 25a49f6: Avoid losing Ctrl-C keystrokes in compilat
From: |
Eli Zaretskii |
Subject: |
[Emacs-diffs] master 25a49f6: Avoid losing Ctrl-C keystrokes in compilation mode on MS-Windows |
Date: |
Tue, 5 Sep 2017 13:34:59 -0400 (EDT) |
branch: master
commit 25a49f64963d1c2a392ebaa66676042b55e0e3c1
Author: Eli Zaretskii <address@hidden>
Commit: Eli Zaretskii <address@hidden>
Avoid losing Ctrl-C keystrokes in compilation mode on MS-Windows
* src/w32proc.c (sys_kill): Preserve the up/down state of the
Ctrl key across the simulated Ctrl-C keystroke. (Bug#28348)
---
src/w32proc.c | 9 +++++++++
1 file changed, 9 insertions(+)
diff --git a/src/w32proc.c b/src/w32proc.c
index 71bd28d..085995d 100644
--- a/src/w32proc.c
+++ b/src/w32proc.c
@@ -2638,6 +2638,12 @@ sys_kill (pid_t pid, int sig)
/* Set the foreground window to the child. */
if (SetForegroundWindow (cp->hwnd))
{
+ /* Record the state of the Ctrl key: the user could
+ have it depressed while we are simulating Ctrl-C,
+ in which case we will have to leave the state of
+ Ctrl depressed when we are done. */
+ short ctrl_state = GetKeyState (VK_CONTROL) & 0x8000;
+
/* Generate keystrokes as if user had typed Ctrl-Break or
Ctrl-C. */
keybd_event (VK_CONTROL, control_scan_code, 0, 0);
@@ -2654,6 +2660,9 @@ sys_kill (pid_t pid, int sig)
Sleep (100);
SetForegroundWindow (foreground_window);
+ /* If needed, restore the state of Ctrl. */
+ if (ctrl_state != 0)
+ keybd_event (VK_CONTROL, control_scan_code, 0, 0);
}
/* Detach from the foreground and child threads now that
the foreground switching is over. */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] master 25a49f6: Avoid losing Ctrl-C keystrokes in compilation mode on MS-Windows,
Eli Zaretskii <=