Better window detection for when a window regains focus.

This commit is contained in:
Storm Dragon committed 2026-10-15 13:25:47 -04:00
1 parent e3de71e594
commit ea509509e4
6 files changed
+67 -14

No files matched your search

+4 -1
View File
@@ -202,7 +202,10 @@ Windows launcher fixture. It reproduces a visible launcher returned without
activation, then checks recovery of its native foreground and button focus.
It also checks Linux focus, mismatched window-manager/keyboard focus, disabled
windows, multiple visible applications, hidden windows, existing foreground,
and repeated recovery. The fixture acknowledges ICCCM window visibility on
and repeated recovery. It also reproduces X11 focus on the launcher child
with no Win32 foreground, as seen after AudioQuake exits: recovery must send
Wine's activation notification even when X11 focus already selects that child.
The fixture acknowledges ICCCM window visibility on
the private display; the runner propagates the fixture's actual exit status.
After installing the updated helper and restarting the reader, open AudioQuake,
+32
View File
@@ -130,6 +130,38 @@ int main(int argc, char **argv) {
focus(linuxWindow, linuxWindow);
focus(desktop, desktop);
ok &= check(restore_virtual_desktop_focus(), "later workspace return recovers again");
pump();
ShowWindow(launcher, SW_HIDE);
pump();
ShowWindow(launcher, SW_SHOWNOACTIVATE);
acknowledge(launcher);
focus(linuxWindow, linuxWindow);
const auto launcherXid = static_cast<xcb_window_t>(reinterpret_cast<uintptr_t>(
GetPropW(launcher, L"__wine_x11_whole_window")));
focus(launcherXid, linuxWindow);
ok &= check(!restore_virtual_desktop_focus(), "focused child requires window manager desktop ownership");
ShowWindow(other, SW_SHOWNOACTIVATE);
acknowledge(other);
focus(launcherXid, desktop);
ok &= check(!restore_virtual_desktop_focus(), "focused child does not bypass ambiguous applications");
ShowWindow(other, SW_HIDE);
const auto siblingXid = xcb_generate_id(connection);
xcb_create_window(connection, XCB_COPY_FROM_PARENT, siblingXid, desktop,
0, 0, 20, 20, 0, XCB_WINDOW_CLASS_INPUT_OUTPUT, screen->root_visual, 0, nullptr);
xcb_map_window(connection, siblingXid);
focus(siblingXid, desktop);
ok &= check(!restore_virtual_desktop_focus(), "unrelated desktop child is never redirected to launcher");
xcb_destroy_window(connection, siblingXid);
focus(launcherXid, desktop);
EnableWindow(launcher, FALSE);
ok &= check(!restore_virtual_desktop_focus(), "focused child does not bypass disabled application guard");
EnableWindow(launcher, TRUE);
ok &= check(!GetForegroundWindow(), "reproduce focused X11 child without Win32 foreground");
ok &= check(restore_virtual_desktop_focus(), "focused launcher child recovers foreground");
pump();
GetGUIThreadInfo(GetWindowThreadProcessId(launcher, nullptr), &gui);
ok &= check(GetForegroundWindow() == launcher && gui.hwndFocus == button,
"focused launcher child restores its control focus");
DestroyWindow(other);
PostMessageW(launcher, WM_CLOSE, 0, 0);
WaitForSingleObject(process.hProcess, 5000);