mirror of
https://github.com/samsonjs/vibetunnel.git
synced 2026-04-27 15:17:38 +00:00
Remove environment variable features and add 4K resolution limit
- Remove VIBETUNNEL_FLIP_Y and VIBETUNNEL_USE_WARP environment variables - Simplify coordinate transformation configuration - Add automatic 4K resolution capping for displays above 4K (like 5K displays) - Scale down proportionally to maintain aspect ratio (e.g., 5120×2880 → 3840×2160) - Prevent web interface clipping on high-resolution displays - Remove MOUSE_CLICK_DEBUG.md and test_display_coordinates.sh - Fix linting issues in various files
This commit is contained in:
parent
53b4aff571
commit
4fc7a5da5b
8 changed files with 39 additions and 118 deletions
|
|
@ -1,82 +0,0 @@
|
|||
# Mouse Click Debug Guide for VibeTunnel Screen Capture
|
||||
|
||||
## Problem
|
||||
Mouse clicks are not working correctly in the screen capture feature. The coordinate system conversion might be incorrect.
|
||||
|
||||
## Changes Made
|
||||
|
||||
1. **Added Environment Variable Controls**:
|
||||
- `VIBETUNNEL_FLIP_Y` - Set to "false" to disable Y-coordinate flipping
|
||||
- `VIBETUNNEL_USE_WARP` - Set to "true" to use CGWarpMouseCursorPosition instead of CGEvent
|
||||
|
||||
2. **Enhanced Debug Logging**:
|
||||
- Extensive coordinate transformation logging
|
||||
- Screen information for all displays
|
||||
- Mouse position before and after moves
|
||||
- Capture mode and filter information
|
||||
|
||||
3. **Improved Mouse Movement**:
|
||||
- Added mouse move before click (already implemented)
|
||||
- Option to use CGWarpMouseCursorPosition for more direct cursor control
|
||||
- Proper multi-monitor support with screen-relative Y-flipping
|
||||
|
||||
## Testing Instructions
|
||||
|
||||
### 1. Test Default Behavior (Y-flipping enabled)
|
||||
```bash
|
||||
./build/Build/Products/Debug/VibeTunnel.app/Contents/MacOS/VibeTunnel
|
||||
```
|
||||
|
||||
### 2. Test Without Y-Coordinate Flipping
|
||||
```bash
|
||||
VIBETUNNEL_FLIP_Y=false ./build/Build/Products/Debug/VibeTunnel.app/Contents/MacOS/VibeTunnel
|
||||
```
|
||||
|
||||
### 3. Test With CGWarpMouseCursorPosition
|
||||
```bash
|
||||
VIBETUNNEL_USE_WARP=true ./build/Build/Products/Debug/VibeTunnel.app/Contents/MacOS/VibeTunnel
|
||||
```
|
||||
|
||||
### 4. Test Both Options
|
||||
```bash
|
||||
VIBETUNNEL_FLIP_Y=false VIBETUNNEL_USE_WARP=true ./build/Build/Products/Debug/VibeTunnel.app/Contents/MacOS/VibeTunnel
|
||||
```
|
||||
|
||||
## What to Look For in Logs
|
||||
|
||||
Use `./scripts/vtlog.sh -f -c ScreencapService` to monitor logs and look for:
|
||||
|
||||
1. **Coordinate Transformation**:
|
||||
- `🔍 [DEBUG] calculateClickLocation - Input: x=XXX, y=YYY`
|
||||
- `🔍 [DEBUG] Configuration: shouldFlipY=true/false, useWarpCursor=true/false`
|
||||
- `🔍 [DEBUG] Y-coordinate flipping DISABLED` (when VIBETUNNEL_FLIP_Y=false)
|
||||
|
||||
2. **Mouse Position**:
|
||||
- `🖱️ Current mouse position: (XXX, YYY)`
|
||||
- `🖱️ [DEBUG] Mouse position after move: (XXX, YYY)`
|
||||
|
||||
3. **Final Coordinates**:
|
||||
- `🎯 [DEBUG] Final coordinates: x=XXX, y=YYY`
|
||||
- `🔍 [DEBUG] Direct pixel coordinates (no Y-flip): x=XXX, y=YYY`
|
||||
|
||||
4. **Errors**:
|
||||
- `❌ [DEBUG] CGWarpMouseCursorPosition failed`
|
||||
- `🔐 [DEBUG] Accessibility permission status: false`
|
||||
|
||||
## Possible Issues
|
||||
|
||||
1. **Accessibility Permission**: Ensure VibeTunnel has accessibility permission in System Settings > Privacy & Security > Accessibility
|
||||
|
||||
2. **Coordinate Systems**:
|
||||
- SCDisplay uses top-left origin (0,0 at top-left)
|
||||
- NSScreen uses bottom-left origin (0,0 at bottom-left)
|
||||
- The Y-flipping might not be needed if SCDisplay coordinates are already converted
|
||||
|
||||
3. **Multi-Monitor**: The code now properly handles multi-monitor setups by finding which screen contains the click point
|
||||
|
||||
## Next Steps
|
||||
|
||||
1. Test each configuration and observe where the mouse actually clicks
|
||||
2. Check if clicks work better with `VIBETUNNEL_FLIP_Y=false`
|
||||
3. Compare logged coordinates with expected click positions
|
||||
4. If still not working, the debug logs will show exactly what coordinates are being used
|
||||
|
|
@ -280,8 +280,8 @@ public final class CaptureConfigurationBuilder {
|
|||
}
|
||||
|
||||
private func limitTo4K(width: Int, height: Int) -> (width: Int, height: Int) {
|
||||
let max4KWidth = 3840
|
||||
let max4KHeight = 2160
|
||||
let max4KWidth = 3_840
|
||||
let max4KHeight = 2_160
|
||||
|
||||
// If already within 4K bounds, return as is
|
||||
if width <= max4KWidth && height <= max4KHeight {
|
||||
|
|
@ -296,7 +296,10 @@ public final class CaptureConfigurationBuilder {
|
|||
let scaledWidth = Int(Double(width) * scale)
|
||||
let scaledHeight = Int(Double(height) * scale)
|
||||
|
||||
logger.info("🔽 Scaling down from \(width)x\(height) to \(scaledWidth)x\(scaledHeight) (scale: \(String(format: "%.2f", scale)))")
|
||||
logger
|
||||
.info(
|
||||
"🔽 Scaling down from \(width)x\(height) to \(scaledWidth)x\(scaledHeight) (scale: \(String(format: "%.2f", scale)))"
|
||||
)
|
||||
|
||||
return (width: scaledWidth, height: scaledHeight)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -288,7 +288,6 @@ public final class CoordinateTransformer {
|
|||
|
||||
return CGPoint(x: clampedX, y: clampedY)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// MARK: - Helper Extensions
|
||||
|
|
|
|||
|
|
@ -311,7 +311,7 @@ final class CLIInstaller {
|
|||
}
|
||||
|
||||
// Update outdated status
|
||||
if let installedHash = installedHash {
|
||||
if let installedHash {
|
||||
self.isOutdated = (installedHash != bundledHash)
|
||||
logger.info("CLIInstaller: Script version check - outdated: \(self.isOutdated)")
|
||||
logger.debug("CLIInstaller: Bundled hash: \(bundledHash), Installed hash: \(installedHash)")
|
||||
|
|
|
|||
|
|
@ -205,7 +205,8 @@ final class AppDelegate: NSObject, NSApplicationDelegate, @preconcurrency UNUser
|
|||
DispatchQueue.main.asyncAfter(deadline: .now() + 0.5) { [weak self] in
|
||||
// Show welcome if version is different from current OR if vt script is outdated
|
||||
if (storedWelcomeVersion < AppConstants.currentWelcomeVersion || cliInstaller.isOutdated)
|
||||
&& !isRunningInTests && !isRunningInPreview {
|
||||
&& !isRunningInTests && !isRunningInPreview
|
||||
{
|
||||
self?.showWelcomeScreen()
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue