Carry the remembered front past the Windows paste as well

The macOS press learned a third argument, the application that was in front
when the recording started, and every backend is handed it. SendInput takes
no such thing: nothing on Windows moves the front while a recording runs, so
the process id arrives and is left alone.

Without this the Windows backend refuses the call the shared press makes, and
the five key tests in tests.test_paste.Windows stop at a TypeError.

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
This commit is contained in:
Gökhan
2026-08-25 00:29:26 +03:00
co-authored by Claude Opus 5
parent 901e57e4d0
commit 0f30c852ab
+4 -1
View File
@@ -488,11 +488,14 @@ class _WinInput(ctypes.Structure):
_fields_ = [("type", ctypes.c_ulong), ("union", _WinInputUnion)] _fields_ = [("type", ctypes.c_ulong), ("union", _WinInputUnion)]
def _win_press(shortcut, delay): def _win_press(shortcut, delay, _focus=None):
"""Post the presses and releases straight into the input queue. """Post the presses and releases straight into the input queue.
No permission stands in front of SendInput the way Accessibility does on No permission stands in front of SendInput the way Accessibility does on
macOS: whatever window has focus receives the combination. macOS: whatever window has focus receives the combination.
Nothing here takes the front from the window being dictated into, so the
remembered process id has nothing to hand back to: it is a macOS concern.
""" """
codes = _win_keys(shortcut) codes = _win_keys(shortcut)
user32, _ = _win_api() user32, _ = _win_api()