Skip to content

Commit a3226fa

Browse files
authored
Throwaway: keep the probe's windows capturable, pick the Theme menu
1 parent a31bbd2 commit a3226fa

2 files changed

Lines changed: 11 additions & 2 deletions

File tree

‎mac/TinyClipsTests/ThemesProbeTests.swift‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,8 +245,12 @@ extension ThemesProbeTests {
245245
try? classes.joined(separator: "\n").write(to: Self.out.appendingPathComponent("mac-views.txt"), atomically: true, encoding: .utf8)
246246

247247
var how = "none"
248-
if let popup = views.compactMap({ $0 as? NSPopUpButton }).first {
249-
how = "NSPopUpButton.performClick"
248+
let popups = views.compactMap { $0 as? NSPopUpButton }
249+
func inWindow(_ view: NSView) -> NSRect { view.convert(view.bounds, to: nil) }
250+
NSLog("PROBE popups %@", popups.map { "\($0.title) \(inWindow($0))" }.joined(separator: " ; "))
251+
let target = NSPoint(x: 178, y: window.frame.height - 37)
252+
if let popup = popups.first(where: { inWindow($0).insetBy(dx: -6, dy: -6).contains(target) }) {
253+
how = "NSPopUpButton.performClick on '\(popup.title)'"
250254
DispatchQueue.main.async { popup.performClick(nil) }
251255
spin(14)
252256
}

‎windows/src/TinyClips.App/Infrastructure/WindowCaptureVisibility.cs‎

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@ internal static class WindowCaptureVisibility
1111

1212
public static void Register(Window window, bool alwaysExcluded = false)
1313
{
14+
if (Environment.GetEnvironmentVariable("TINYCLIPS_THEMES_PROBE_OUT") is { Length: > 0 })
15+
{
16+
return;
17+
}
18+
1419
var hwnd = WindowNative.GetWindowHandle(window);
1520
window.Closed += OnClosed;
1621
try

0 commit comments

Comments
 (0)