Skip to content

Fix video stream not displaying at app launch, fix keyboard do not work when app "at the top" - #2

Merged
Chow411 merged 1 commit into
mainfrom
fix/video-stream-at-launch
Jun 23, 2026
Merged

Fix video stream not displaying at app launch, fix keyboard do not work when app "at the top"#2
Chow411 merged 1 commit into
mainfrom
fix/video-stream-at-launch

Conversation

@Chow411

@Chow411 Chow411 commented Jun 23, 2026

Copy link
Copy Markdown
Owner

Bug 1: Video session started without input
In applyConnectionProtocolMode(), the KVM mode path called startVideoSession() which only starts the capture session with a delay, but doesn't add any video input. Since devices were already connected at app launch, the AVCaptureDeviceWasConnected notification never fires, leaving the session empty with no recovery path.

Fix: Changed to call prepareVideo() which performs the full initialization:

  • Updates USB devices
  • Discovers and matches video devices by locationID
  • Adds input to capture session via setupVideoCapture()
  • Starts the video session

Bug 2: AppStatus device references not synchronized In updateChipsetTypeFlag(), local variables were reset to nil but AppStatus.videoChipDevice and AppStatus.controlChipDevice were not reset. This caused stale device references that could match against wrong locationIDs.

Fix: Reset both local and AppStatus device references at start of updateChipsetTypeFlag() to keep them synchronized.

Also includes fixes for always-on-top keyboard issue and floating keyboard window level management.

Fixes TechxArtisanStudio#115

Bug 1: Video session started without input
In applyConnectionProtocolMode(), the KVM mode path called startVideoSession()
which only starts the capture session with a delay, but doesn't add any video input.
Since devices were already connected at app launch, the AVCaptureDeviceWasConnected
notification never fires, leaving the session empty with no recovery path.

Fix: Changed to call prepareVideo() which performs the full initialization:
- Updates USB devices
- Discovers and matches video devices by locationID
- Adds input to capture session via setupVideoCapture()
- Starts the video session

Bug 2: AppStatus device references not synchronized
In updateChipsetTypeFlag(), local variables were reset to nil but
AppStatus.videoChipDevice and AppStatus.controlChipDevice were not reset.
This caused stale device references that could match against wrong locationIDs.

Fix: Reset both local and AppStatus device references at start of
updateChipsetTypeFlag() to keep them synchronized.

Also includes fixes for always-on-top keyboard issue and floating keyboard
window level management.

Fixes TechxArtisanStudio#115
Copilot AI review requested due to automatic review settings June 23, 2026 03:46
@Chow411
Chow411 merged commit 546f35f into main Jun 23, 2026
1 check passed

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR addresses multiple launch-time and “always-on-top” UX bugs by ensuring video capture is fully initialized when entering KVM mode, keeping USB device references consistent across scans, and refining keyboard routing/window-level behavior so the floating keyboard remains usable when the main window is set above normal level.

Changes:

  • Switch KVM protocol path to call prepareVideo() (full capture initialization) instead of startVideoSession() (session start only).
  • Reset both local and AppStatus USB device references during chipset detection to avoid stale device matches.
  • Adjust keyboard pass-through logic and floating keyboard focus/level management for always-on-top scenarios.

Reviewed changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 2 comments.

File Description
openterface/Managers/Target/KeyBoardManager.swift Refines pass-through window detection to avoid breaking keyboard routing when the main window is floating.
openterface/Managers/Host/USBDevicesManager.swift Keeps local/AppStatus USB device references synchronized to prevent stale device matching.
openterface/Managers/FloatingKeyboardManager.swift Updates focus-loss detection and sets floating keyboard window level relative to main window.
openterface/AppDelegate.swift Uses prepareVideo() when switching to KVM to ensure capture inputs are configured at launch.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +51 to 55
// Observe app losing active focus (e.g., user switches to another app)
// This is better than observing didResignMain, which fires when clicking the floating keyboard itself
focusLostObserver = NotificationCenter.default.addObserver(
forName: NSWindow.didResignMainNotification,
forName: NSApplication.didResignActiveNotification,
object: nil,
let mainWindowLevel = NSApplication.shared.windows
.first(where: { $0.identifier?.rawValue.contains(UserSettings.shared.mainWindownName) ?? false })?
.level ?? .normal
let keyboardWindowLevel = NSWindow.Level(rawValue: mainWindowLevel.rawValue + 1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Always on Top" silently breaks the physical keyboard (every keypress beeps on host, nothing reaches target)

2 participants