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 {
354354
         let screen_width = (screen_max_x - screen_min_x) as f64;
355355
         let screen_height = (screen_max_y - screen_min_y) as f64;
356356
 
357
+        // Offset from edge to prevent immediate re-triggering of edge detection
358
+        const EDGE_INSET: i32 = 30;
359
+
357360
         let cursor_pos = match payload.cursor_pos {
358361
             CursorEntryPos::EdgeRelative(rel) => {
359362
                 // from_direction indicates which edge the cursor enters from
360363
                 // e.g., from_direction=Left means cursor enters at our left edge
361364
                 match from_direction {
362365
                     Direction::Left => {
363
-                        // Cursor enters from left edge
366
+                        // Cursor enters from left edge - position slightly inward
364367
                         let y = screen_min_y + (rel * screen_height) as i32;
365
-                        (screen_min_x, y)
368
+                        (screen_min_x + EDGE_INSET, y)
366369
                     }
367370
                     Direction::Right => {
368
-                        // Cursor enters from right edge
371
+                        // Cursor enters from right edge - position slightly inward
369372
                         let y = screen_min_y + (rel * screen_height) as i32;
370
-                        (screen_max_x - 1, y)
373
+                        (screen_max_x - EDGE_INSET, y)
371374
                     }
372375
                     Direction::Up => {
373
-                        // Cursor enters from top edge
376
+                        // Cursor enters from top edge - position slightly inward
374377
                         let x = screen_min_x + (rel * screen_width) as i32;
375
-                        (x, screen_min_y)
378
+                        (x, screen_min_y + EDGE_INSET)
376379
                     }
377380
                     Direction::Down => {
378
-                        // Cursor enters from bottom edge
381
+                        // Cursor enters from bottom edge - position slightly inward
379382
                         let x = screen_min_x + (rel * screen_width) as i32;
380
-                        (x, screen_max_y - 1)
383
+                        (x, screen_max_y - EDGE_INSET)
381384
                     }
382385
                 }
383386
             }