Restore wine access after program loses and regains focus.

This commit is contained in:
Storm Dragon committed 2026-10-12 04:17:31 -04:00
1 parent f40e471938
commit c3e981b4c2
12 files changed
+351 -2

No files matched your search

+29
View File
@@ -0,0 +1,29 @@
"""Run the foreground fixture in its own configured Wine virtual desktop."""
import os
from pathlib import Path
import subprocess
import sys
buildDir = Path(sys.argv[1]).resolve()
env = os.environ.copy()
env.update(WINEPREFIX=str(buildDir / "focus-prefix"),
CTHULHU_WINE_ACCESS_MANAGED="1", WINEDEBUG="-all",
WINEDLLOVERRIDES="mscoree,mshtml=")
try:
for key, value, data in (
(r"HKCU\Software\Wine\Explorer", "Desktop", "WineAccessFocusFixture"),
(r"HKCU\Software\Wine\Explorer\Desktops", "WineAccessFocusFixture", "800x600"),
):
subprocess.run(["wine", "reg", "add", key, "/v", value,
"/t", "REG_SZ", "/d", data, "/f"],
env=env, check=True, timeout=40)
# The next loader must create the configured desktop. Wait for this test
# prefix's old server to stop, without touching any user application.
subprocess.run(["wineserver", "-k"], env=env, check=True, timeout=5)
subprocess.run(["wineserver", "-w"], env=env, check=True, timeout=5)
result = subprocess.run([str(buildDir / "foreground-focus-test.exe"),
str(buildDir / "foreground-fixture.exe")],
env=env, timeout=20)
sys.exit(result.returncode)
finally:
subprocess.run(["wineserver", "-k"], env=env, timeout=5)