Skip to content

Update onMouseMoveSecondary to allow offset adjustments#7511

Merged
nbolton merged 1 commit intodeskflow:masterfrom
spurin:mouse_speed
Sep 24, 2024
Merged

Update onMouseMoveSecondary to allow offset adjustments#7511
nbolton merged 1 commit intodeskflow:masterfrom
spurin:mouse_speed

Conversation

@spurin
Copy link
Copy Markdown
Contributor

@spurin spurin commented Sep 12, 2024

Fixes: #4245

Blocked by: #7522, #7569


We now have a working prototype where onMouseMoveSecondary can be adjusted via an environment variable at startup. This implementation is server-side and relates to the issue discussed at #4245 (credit to @neworld for their initial implementation).

To double the mouse speed, use the following on the server side:

DESKFLOW_MOUSE_ADJUSTMENT=2; open /Applications/Synergy.app

This results in consistent mouse speed across my Mac OS X server and HiDPI Windows client, achieving the desired functional outcome.

To reduce the speed, you can modify the value like so:

DESKFLOW_MOUSE_ADJUSTMENT=0.3; open /Applications/Synergy.app

In the future, this could ideally be managed through the UI, with the ability to apply different speed adjustments for specific targets, rather than having a global setting. In my case, I only have two systems, so this works fine, but others may require more granular control.

Consider this a proof of concept for reference, rather than code intended for direct inclusion in the upstream codebase.

Edit: updated with final env var name

@nbolton
Copy link
Copy Markdown
Member

nbolton commented Sep 12, 2024

@spurin Oh! getenv! Great idea. Very mergeable and easier than fiddling with CLI args. I'll test in the morning 👍

Edit: I'll get to the bottom of why the Windows runner is failing at the deps step. Quite certain that it's a cache issue totally unrelated to your PR.

@spurin
Copy link
Copy Markdown
Contributor Author

spurin commented Sep 12, 2024

Regarding the setting of 2x that I'm using, the mouse speed is perfect and consistent now.

I wonder on the explanation for this.

I have 2 x 4K screens, 3840x2160

Mac Retina is a 1080p "like" resolution on a 4K screen, providing that retina sharpness and crispness by pixel doubling.

My windows desktop is 4K, albeit with a percentage zoom in.

I believe that the retina aspect on mac may be treating the pixel count as a 1080p screen, when we switch to windows, the pixel count is double, hence the slow down of the mouse movement.

Coincidently, when I tried Share Mouse, I also needed to move the bar to 200% to get the equivalent result.

Mentioning this as retina mode is standard on Mac OS and it may be worthwhile thinking about this from a UI/settings implementation.

@neworld
Copy link
Copy Markdown

neworld commented Sep 17, 2024

As the user, I can recommend rounding fractional numbers to the 1 because having a 0.5 coefficient means the mouse won't move during 1px movements. It wasn't enjoyable. Because of that, I implemented flooring (instead of rounding) with my limited knowledge of C++.

@nbolton
Copy link
Copy Markdown
Member

nbolton commented Sep 17, 2024

@spurin Heads up, we're renaming the upstream 'Synergy Community Edition' to Deskflow. Once that's done we can work on getting this PR merged. Sorry for the delay. Discussion: #7517

@spurin
Copy link
Copy Markdown
Contributor Author

spurin commented Sep 17, 2024

Thanks for the heads up, interesting name. I like it!

@sithlord48
Copy link
Copy Markdown
Member

sithlord48 commented Sep 17, 2024

Would it be possible to make this part of the client/server config ?

@nbolton
Copy link
Copy Markdown
Member

nbolton commented Sep 17, 2024

Would it be possible to make this part of the client/server config ?

I think so. Env var is good for developer testing, but for regular users, config would be easier.

@sithlord48 Edit: In the interest of moving forward, maybe we should do the GUI config stuff in a separate PR?

@nbolton
Copy link
Copy Markdown
Member

nbolton commented Sep 20, 2024

@spurin Would you like us to fix the SonarCloud-idenfied smells or would you prefer we do it?

@spurin
Copy link
Copy Markdown
Contributor Author

spurin commented Sep 20, 2024

@nbolton I'm more than happy for yourself or anybody to take this on and use/re-use/update the code as required to make it useful for the task in hand.

For context, I treated this as a functional prototype and for my own personal needs at present it suits me well.

Whilst I'd rather have the slick features of Synergy 3, the mouse aspect is currently more important at present (am doing a lot of design/creative work between mac and windows). So I'm happy to live with this workaround until it takes a better form in the future.

You steer your own ship much better than I, appreciate the ask. In this case please do as you see fit with it 👍

@nbolton
Copy link
Copy Markdown
Member

nbolton commented Sep 20, 2024

I'm more than happy for yourself or anybody to take this on

@spurin No problem, I'll take a look at getting these issues fixed soon so we can merge this in. I appreciate the time you've spent so far and thanks for sharing your solution with us.

Would it be possible to make this part of the client/server config ?

@sithlord48 What did you think about doing the config improvements in a new PR?

@sithlord48 sithlord48 force-pushed the mouse_speed branch 2 times, most recently from 7f7360e to d6b2d2a Compare September 21, 2024 11:25
@sithlord48
Copy link
Copy Markdown
Member

If we land this without making the config / gui changes we need to be sure this gets documented so we do not forget todo it .

@nbolton nbolton force-pushed the mouse_speed branch 4 times, most recently from fb10f52 to 766eabb Compare September 21, 2024 23:08
@sithlord48
Copy link
Copy Markdown
Member

@nbolton iirc we were testing our linting on this pr ? that is all im waiting for to land

@nbolton
Copy link
Copy Markdown
Member

nbolton commented Sep 22, 2024

that is all im waiting for to land

I believe there are 3 things we need to do before landing:

Edit: Actually, I think we can fix code smells on a different PR.

@nbolton nbolton force-pushed the mouse_speed branch 2 times, most recently from 0637796 to 433f36e Compare September 23, 2024 19:28
@nbolton
Copy link
Copy Markdown
Member

nbolton commented Sep 23, 2024

❌🛠️ clang-format: Lint errors, fix available.

Code style applied.

Edit: Download packages (available for limited time)

As the user, I can recommend rounding fractional numbers to the 1 because having a 0.5 coefficient means the mouse won't move during 1px movements. It wasn't enjoyable. Because of that, I implemented flooring (instead of rounding) with my limited knowledge of C++.

@neworld Do you think the current PR needs any more changes?

@spurin Are you happy for this to be merged in its current state?

@nbolton nbolton force-pushed the mouse_speed branch 2 times, most recently from 1abc1e4 to c001b4f Compare September 23, 2024 20:14
@spurin
Copy link
Copy Markdown
Contributor Author

spurin commented Sep 23, 2024

@spurin Are you happy for this to be merged in its current state?

All good by me @nbolton

@nbolton
Copy link
Copy Markdown
Member

nbolton commented Sep 24, 2024

@spurin Are you happy for this to be merged in its current state?

All good by me @nbolton

@spurin I changed the env var to DESKFLOW_MOUSE_ADJUSTMENT as suggested by @sithlord48. Would you mind double-checking it works as expected with the renamed env var?

@nbolton nbolton enabled auto-merge (rebase) September 24, 2024 09:34
@sithlord48
Copy link
Copy Markdown
Member

sithlord48 commented Sep 24, 2024

Approved once @spurin confirms the name change was successful.

@spurin
Copy link
Copy Markdown
Contributor Author

spurin commented Sep 24, 2024

It's looking good! Testing successful.

Screenshot 2024-09-24 at 15 12 44

@nbolton nbolton requested a review from sithlord48 September 24, 2024 15:03
@nbolton
Copy link
Copy Markdown
Member

nbolton commented Sep 24, 2024

Approved once @spurin confirms the name change was successful.

@sithlord48 The change request is blocking the merge. Happy for me to dismiss your review, or would you prefer to re-approve?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Mouse is slow on a high DPI Windows client

4 participants