tenseleyflow/hyprkvm / 3ca05aa

Browse files

fix: position cursor inward from edge to prevent ping-pong transfers

When receiving control, the cursor was positioned at the exact screen
edge (e.g., y=1439 on a 1440-height screen). This caused immediate
re-triggering of edge detection, sending control right back.

Add 30-pixel inset from edge when positioning cursor on entry.
Authored by mfwolffe <wolffemf@dukes.jmu.edu>
SHA
3ca05aaec671180f7325a4b45ef249d58b44d373
Parents
2b6d82c
Tree
87ff4b2

1 changed file

StatusFile+-
M hyprkvm-daemon/src/transfer/manager.rs 11 8
hyprkvm-daemon/src/transfer/manager.rsmodified
@@ -354,30 +354,33 @@ impl TransferManager {
354
         let screen_width = (screen_max_x - screen_min_x) as f64;
354
         let screen_width = (screen_max_x - screen_min_x) as f64;
355
         let screen_height = (screen_max_y - screen_min_y) as f64;
355
         let screen_height = (screen_max_y - screen_min_y) as f64;
356
 
356
 
357
+        // Offset from edge to prevent immediate re-triggering of edge detection
358
+        const EDGE_INSET: i32 = 30;
359
+
357
         let cursor_pos = match payload.cursor_pos {
360
         let cursor_pos = match payload.cursor_pos {
358
             CursorEntryPos::EdgeRelative(rel) => {
361
             CursorEntryPos::EdgeRelative(rel) => {
359
                 // from_direction indicates which edge the cursor enters from
362
                 // from_direction indicates which edge the cursor enters from
360
                 // e.g., from_direction=Left means cursor enters at our left edge
363
                 // e.g., from_direction=Left means cursor enters at our left edge
361
                 match from_direction {
364
                 match from_direction {
362
                     Direction::Left => {
365
                     Direction::Left => {
363
-                        // Cursor enters from left edge
366
+                        // Cursor enters from left edge - position slightly inward
364
                         let y = screen_min_y + (rel * screen_height) as i32;
367
                         let y = screen_min_y + (rel * screen_height) as i32;
365
-                        (screen_min_x, y)
368
+                        (screen_min_x + EDGE_INSET, y)
366
                     }
369
                     }
367
                     Direction::Right => {
370
                     Direction::Right => {
368
-                        // Cursor enters from right edge
371
+                        // Cursor enters from right edge - position slightly inward
369
                         let y = screen_min_y + (rel * screen_height) as i32;
372
                         let y = screen_min_y + (rel * screen_height) as i32;
370
-                        (screen_max_x - 1, y)
373
+                        (screen_max_x - EDGE_INSET, y)
371
                     }
374
                     }
372
                     Direction::Up => {
375
                     Direction::Up => {
373
-                        // Cursor enters from top edge
376
+                        // Cursor enters from top edge - position slightly inward
374
                         let x = screen_min_x + (rel * screen_width) as i32;
377
                         let x = screen_min_x + (rel * screen_width) as i32;
375
-                        (x, screen_min_y)
378
+                        (x, screen_min_y + EDGE_INSET)
376
                     }
379
                     }
377
                     Direction::Down => {
380
                     Direction::Down => {
378
-                        // Cursor enters from bottom edge
381
+                        // Cursor enters from bottom edge - position slightly inward
379
                         let x = screen_min_x + (rel * screen_width) as i32;
382
                         let x = screen_min_x + (rel * screen_width) as i32;
380
-                        (x, screen_max_y - 1)
383
+                        (x, screen_max_y - EDGE_INSET)
381
                     }
384
                     }
382
                 }
385
                 }
383
             }
386
             }