Fix video stream not displaying at app launch, fix keyboard do not work when app "at the top" - #2
Merged
Merged
Conversation
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
There was a problem hiding this comment.
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 ofstartVideoSession()(session start only). - Reset both local and
AppStatusUSB 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) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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:
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