Add window-based target picker as the default; process list goes advanced

New host/src/inject/window_list.{hpp,cpp} enumerates visible, titled, non-tool
top-level (alt-tab-style) windows via EnumWindows -- root-owner only, our own
process excluded -- and maps each to its owning pid + image name. The Injection
panel now defaults to this window list (each row "title [process.exe pid]", with a
filter over title or process), since there are far fewer windows than processes and
a window maps straight to the HWND the capturer wants. The full process list stays
as the advanced picker under Debug details.

Verified live: launched the host and captured its window -- the picker lists real
windows (Discord/Firefox/Explorer/...) in "title [exe pid]" form, filter present,
and the host's own window correctly excluded. x64 build green.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This commit is contained in:
2026-06-21 01:14:05 +02:00
parent b0f78312c6
commit 80cc5e72bd
6 changed files with 159 additions and 23 deletions

View File

@@ -0,0 +1,24 @@
// Enumerates visible top-level windows for the injection target picker. There are
// far fewer windows than processes, and a window maps directly to the HWND the
// capturer wants, so this is the default (friendlier) way to pick a game.
#pragma once
#include <string>
#include <vector>
namespace coop
{
struct WindowEntry
{
unsigned long pid = 0; // owning process id
void* hwnd = nullptr; // HWND (opaque here to keep windows.h out of the header)
std::wstring title; // window caption
std::wstring exe_name; // owning process image base name, e.g. "game.exe"
};
// Snapshot of the visible, titled, non-tool top-level (alt-tab-style) windows, with
// our own process's windows excluded. Sorted by title (case-insensitive).
std::vector<WindowEntry> list_windows();
} // namespace coop