[GH-ISSUE #83] cursor bound to single screen #29

Closed
opened 2026-05-05 22:05:18 -06:00 by gitea-mirror · 7 comments
Owner

Originally created by @jpeeler on GitHub (Jan 26, 2024).
Original GitHub issue: https://github.com/feschber/lan-mouse/issues/83

With the merge of #81, I was able to test lan-mouse for the first time between a Linux server and MacOS client. I'm using multiple screens and see that when the mouse works on the remote client screen, it is not able to continue to the adjoining screens.

I was kind of hoping that the mouse would automatically release on the edge when traversing to go back to the server. Unsure if that's because of the above issue or if you have to press the release keys by design.

(Unrelated, but there is some keyboard weirdness with the server not passing through keystrokes that are already mapped for usage in the compositor. Will report that later in another issue.)

Originally created by @jpeeler on GitHub (Jan 26, 2024). Original GitHub issue: https://github.com/feschber/lan-mouse/issues/83 With the merge of #81, I was able to test lan-mouse for the first time between a Linux server and MacOS client. I'm using multiple screens and see that when the mouse works on the remote client screen, it is not able to continue to the adjoining screens. I was kind of hoping that the mouse would automatically release on the edge when traversing to go back to the server. Unsure if that's because of the above issue or if you have to press the release keys by design. (Unrelated, but there is some keyboard weirdness with the server not passing through keystrokes that are already mapped for usage in the compositor. Will report that later in another issue.)
gitea-mirror 2026-05-05 22:05:18 -06:00
  • closed this issue
  • added the
    macos
    label
Author
Owner

@feschber commented on GitHub (Jan 26, 2024):

Yes, this is macos related. The API is a bit weird there: https://github.com/feschber/lan-mouse/blob/5cc8cda19d2bef25cff0d767361d0622a8fbf3e8/src/backend/consumer/macos.rs#L120

Problem is that unless the absolute mouse position is restricted to screen boundaries, the relative motion gets lost in fullscreen applications. I currently restrict it to the primary screen. Need to fix that but have not yet found the time.

diff --git a/src/backend/consumer/macos.rs b/src/backend/consumer/macos.rs
index 954ec2b..3c45e13 100644
--- a/src/backend/consumer/macos.rs
+++ b/src/backend/consumer/macos.rs
@@ -135,8 +135,8 @@ impl EventConsumer for MacOSConsumer {
                         }
                     };
 
-                    mouse_location.x = (mouse_location.x + relative_x).clamp(min_x, max_x - 1.);
-                    mouse_location.y = (mouse_location.y + relative_y).clamp(min_y, max_y - 1.);
+                    mouse_location.x = (mouse_location.x + relative_x);
+                    mouse_location.y = (mouse_location.y + relative_y);
 
                     let mut event_type = CGEventType::MouseMoved;
                     if self.button_state.left {

This patch should remove this restriction but therefore breaks fullscreen apps that grab the mouse

(safe the patch to a file (e.g. patch) and run

git apply < patch
<!-- gh-comment-id:1912288620 --> @feschber commented on GitHub (Jan 26, 2024): Yes, this is macos related. The API is a bit weird there: [https://github.com/feschber/lan-mouse/blob/5cc8cda19d2bef25cff0d767361d0622a8fbf3e8/src/backend/consumer/macos.rs#L120](https://github.com/feschber/lan-mouse/blob/5cc8cda19d2bef25cff0d767361d0622a8fbf3e8/src/backend/consumer/macos.rs#L120) Problem is that unless the absolute mouse position is restricted to screen boundaries, the relative motion gets lost in fullscreen applications. I currently restrict it to the primary screen. Need to fix that but have not yet found the time. ```diff diff --git a/src/backend/consumer/macos.rs b/src/backend/consumer/macos.rs index 954ec2b..3c45e13 100644 --- a/src/backend/consumer/macos.rs +++ b/src/backend/consumer/macos.rs @@ -135,8 +135,8 @@ impl EventConsumer for MacOSConsumer { } }; - mouse_location.x = (mouse_location.x + relative_x).clamp(min_x, max_x - 1.); - mouse_location.y = (mouse_location.y + relative_y).clamp(min_y, max_y - 1.); + mouse_location.x = (mouse_location.x + relative_x); + mouse_location.y = (mouse_location.y + relative_y); let mut event_type = CGEventType::MouseMoved; if self.button_state.left { ``` This patch should remove this restriction but therefore breaks fullscreen apps that grab the mouse (safe the patch to a file (e.g. `patch`) and run ```sh git apply < patch ```
Author
Owner

@feschber commented on GitHub (Jan 26, 2024):

(Unrelated, but there is some keyboard weirdness with the server not passing through keystrokes that are already mapped for usage in the compositor. Will report that later in another issue.)

What compositor are you using on the server side?

<!-- gh-comment-id:1912290166 --> @feschber commented on GitHub (Jan 26, 2024): > (Unrelated, but there is some keyboard weirdness with the server not passing through keystrokes that are already mapped for usage in the compositor. Will report that later in another issue.) What compositor are you using on the server side?
Author
Owner

@jpeeler commented on GitHub (Jan 26, 2024):

That restriction removal works, but then seems to let the mouse descend off the edge display forever.

I'm using hyprland. Would you like a separate issue made?

<!-- gh-comment-id:1912339632 --> @jpeeler commented on GitHub (Jan 26, 2024): That restriction removal works, but then seems to let the mouse descend off the edge display forever. I'm using hyprland. Would you like a separate issue made?
Author
Owner

@feschber commented on GitHub (Jan 26, 2024):

A yeah, Hyprland has some issues.

  • It reports that shortcuts-inhibit is supported but its not actually implemented. This is probably what you are experiencing.
  • The pointer-constraints implementation was broken recently in conjunction with layershell (I already reported that)
  • The pointer constraints stop working when the cursor is moved on a second screen (it somehow moves even though its locked)

https://github.com/hyprwm/Hyprland/issues/4465
https://github.com/hyprwm/Hyprland/issues/4464

But there is nothing I can fix on my end.

<!-- gh-comment-id:1912349900 --> @feschber commented on GitHub (Jan 26, 2024): A yeah, Hyprland has some issues. - It reports that shortcuts-inhibit is supported but its not actually implemented. This is probably what you are experiencing. - The pointer-constraints implementation was broken recently in conjunction with layershell (I already reported that) - The pointer constraints stop working when the cursor is moved on a second screen (it somehow moves even though its locked) https://github.com/hyprwm/Hyprland/issues/4465 https://github.com/hyprwm/Hyprland/issues/4464 But there is nothing I can fix on my end.
Author
Owner

@jpeeler commented on GitHub (Feb 29, 2024):

Good news, shortcuts-inhibit is now implemented.

https://github.com/hyprwm/Hyprland/pull/4889 is requesting for testing, specifically for 4665 but maybe 4464 is also potentially fixed?

Maybe you already saw all of this, but figured getting your input on the fix would be nice.

<!-- gh-comment-id:1971558276 --> @jpeeler commented on GitHub (Feb 29, 2024): Good news, shortcuts-inhibit is now [implemented](https://github.com/hyprwm/Hyprland/commit/38ad7a829c2b45369d867df3e3a8bf5ffff382ff). https://github.com/hyprwm/Hyprland/pull/4889 is requesting for testing, specifically for 4665 but maybe 4464 is also potentially fixed? Maybe you already saw all of this, but figured getting your input on the fix would be nice.
Author
Owner

@feschber commented on GitHub (Mar 1, 2024):

Yes I have seen it but not hat the time to test until now.
Both are fixed :) And shortcuts inhibit also work. That's great news.

<!-- gh-comment-id:1973106335 --> @feschber commented on GitHub (Mar 1, 2024): Yes I have seen it but not hat the time to test until now. Both are fixed :) And shortcuts inhibit also work. That's great news.
Author
Owner

@Jacoby6000 commented on GitHub (Sep 18, 2024):

For the macos issue where the cursor is stuck on a single monitor, I have implemented a fix: #202

<!-- gh-comment-id:2359423482 --> @Jacoby6000 commented on GitHub (Sep 18, 2024): For the macos issue where the cursor is stuck on a single monitor, I have implemented a fix: #202
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference: github-starred/lan-mouse#29
No description provided.