Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,13 @@ support. A modern **.NET Desktop Runtime** (such as .NET 8) is a separate produc
and does not replace the .NET Framework 4.8 dependency of older applications.
Compatibility still depends on each application's Windows APIs.

Room preparation supplies missing US and German keyboard layout descriptions for
native .NET Framework clients that read `InputLanguage.LayoutName`. Existing
descriptions and the selected Mac keyboard layout are preserved. The regression
probe in `winrt/tests/keyboard_layout_names.cs` reads the current and installed
layouts through WinForms; compile it with the room's .NET Framework `csc.exe` and
`/r:System.Windows.Forms.dll`, then run it in the same room.

Native .NET Framework 4.8 and the WinRT bridge belong to the shared baseline and
are supplied to every room automatically. There is no separate installation tile
and no opt-in room profile. Preparation may take several minutes the first time.
Expand Down
13 changes: 13 additions & 0 deletions scripts/init-prefix.sh
Original file line number Diff line number Diff line change
Expand Up @@ -236,6 +236,19 @@ fi

rm -f "$cursor_query"

# WinForms InputLanguage.LayoutName reads this registry tree, even when Wine
# already provides the keyboard through the Mac driver. A missing tree crashes
# native .NET clients during startup. Keep existing layout descriptions intact.
for layout in '00000409|US' '00000407|German'; do
layout_key='HKLM\SYSTEM\CurrentControlSet\Control\Keyboard Layouts\'"${layout%%|*}"
if ! WINMAC_EXPECT_NONZERO=1 "$BIN/virtual" reg query "$layout_key" /v 'Layout Text' >/dev/null 2>&1; then
"$BIN/virtual" reg add "$layout_key" /v 'Layout Text' /t REG_SZ /d "${layout#*|}" /f >/dev/null 2>&1 \
|| fail "Tastaturlayout konnte nicht eingerichtet werden: ${layout%%|*}"
fi
"$BIN/virtual" reg query "$layout_key" /v 'Layout Text' >/dev/null 2>&1 \
|| fail "Tastaturlayout ist nicht lesbar: ${layout%%|*}"
done

# .NET: nur anbieten, wenn eine Datei bereitliegt (kein Zwang, kein Download hier).
DOTNET="${WINMAC_DOTNET:-$HOME/Downloads/dotnet-desktop.exe}"
DOTNET_FAILED=0
Expand Down
7 changes: 7 additions & 0 deletions scripts/package-engine.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ DEST="${1:?Destination Engine directory required}"
[ "$(basename "$DEST")" = Engine ] || { echo "Destination must be named Engine." >&2; exit 1; }
RUNTIME="${WINMAC_RUNTIME:-$ROOT/runtime}"
[ -x "$RUNTIME/wine-build/bin/wine" ] || { echo "A source-built Wine engine is required for releases." >&2; exit 1; }
# A build-only Wine run leaves the installed runtime unchanged. Check the driver
# being packaged, since the old foreground path can shut down kiosk desktops.
MAC_DRIVER="$RUNTIME/wine-build/lib/wine/x86_64-unix/winemac.so"
nm -u "$MAC_DRIVER" | awk '$NF == "_NtUserSetForegroundWindow" { found = 1 } END { exit !found }' || {
echo "The installed Mac driver lacks the foreground-clearing API. Rebuild and install Wine before packaging (without WINMAC_BUILD_ONLY=1)." >&2
exit 1
}
[ -f "$RUNTIME/wine-build/share/wine/mono/wine-mono-10.4.1/support/winemono-support.msi" ] || {
echo "Wine Mono is missing; run scripts/setup-managed-runtime.sh first." >&2; exit 1;
}
Expand Down
66 changes: 66 additions & 0 deletions winrt/tests/README-foreground-desktop-probe.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Foreground and input-desktop probe

`foreground_desktop_probe.c` is a standalone Win32 probe. It creates only a
visible probe window, an intentionally hidden sentinel, and (for the custom
case) a desktop named `VirtualFocusProbe`. It does not change SEB or another
application's focus policy.

## Build

With Zig installed, build the PE executable without a Wine build tree:

```sh
TEST_DIR=/path/to/Virtual/winrt/tests
ZIG_LOCAL_CACHE_DIR=/tmp/foreground-desktop-probe-zig-cache \
zig cc -target x86_64-windows-gnu -Wall -Wextra -Werror \
"$TEST_DIR/foreground_desktop_probe.c" \
-o /tmp/foreground_desktop_probe.exe -Wl,/subsystem:console
```

## Isolated process-exit cases

Use the `wine` and `wineboot` belonging to the engine under evaluation. Create
a new disposable prefix for each case; never point these commands at a user
room. Initialize each prefix with its engine's `wineboot -u`, then run:

```sh
WINEPREFIX=/tmp/foreground-probe-graceful WINEARCH=win64 VIRTUAL_STAY_ACTIVE=0 \
/path/to/engine/bin/wine /tmp/foreground_desktop_probe.exe --lifecycle graceful
WINEPREFIX=/tmp/foreground-probe-abrupt WINEARCH=win64 VIRTUAL_STAY_ACTIVE=0 \
/path/to/engine/bin/wine /tmp/foreground_desktop_probe.exe --lifecycle abrupt
```

The parent must report `custom_seen=1`, `default_restored=1`, the expected child
exit code (`0` graceful, `23` abrupt), and `hidden_visible=0`. The graceful
child destroys its visible window then exits without switching desktops back;
the abrupt child is terminated while its custom desktop is still active. Both
exercise automatic input-desktop restoration. After each run, stop and wait on
only that disposable prefix's wineserver before removing the prefix.
These Win32 assertions do not establish native Mac window visibility. Also
verify that the default desktop's visible window reappears on macOS and that
the intentionally hidden window remains absent.

## macOS app deactivation observation

Run one focus case at a time from its own disposable prefix:

```sh
WINEPREFIX=/tmp/foreground-probe-default WINEARCH=win64 VIRTUAL_STAY_ACTIVE=0 \
/path/to/engine/bin/wine /tmp/foreground_desktop_probe.exe --focus default 90
WINEPREFIX=/tmp/foreground-probe-custom WINEARCH=win64 VIRTUAL_STAY_ACTIVE=0 \
/path/to/engine/bin/wine /tmp/foreground_desktop_probe.exe --focus custom 90
```

While each visible window is active, switch normally to another macOS app once,
wait briefly, then return to the probe. The log records `WM_ACTIVATEAPP`,
`WM_ACTIVATE`, `WM_KILLFOCUS`, the input desktop name, `GetForegroundWindow()`,
and its classification (`zero`, `desktop`, `probe-window`, or
`other-window`). On macOS app deactivation the foreground must become `zero`,
never `desktop`; on return the probe window must be foreground again.
The focus run does not periodically force
foreground after startup, so the user's ordinary deactivation remains real.

For custom mode, `VirtualFocusProbe` must remain the input desktop through the
macOS app switch and return; this distinguishes app deactivation from a Windows
desktop switch. These are manual UI acceptance cases; merely building or
starting the probe does not establish them.
Loading