Skip to content

feat: add mouse speed control setting#8075

Closed
onyedikachi-david wants to merge 1 commit intodeskflow:masterfrom
onyedikachi-david:feature/mouse-speed-control
Closed

feat: add mouse speed control setting#8075
onyedikachi-david wants to merge 1 commit intodeskflow:masterfrom
onyedikachi-david:feature/mouse-speed-control

Conversation

@onyedikachi-david
Copy link
Copy Markdown

Description

Added a new mouse speed control feature that allows users to adjust cursor movement speed when in client mode. This enhancement provides better control and customization of mouse behavior.

Changes

  • Added mouse speed multiplier setting in client preferences (range: 0.01-10.00)
  • Implemented speed adjustment logic in Server class
  • Added configuration options in AppConfig
  • Updated UI with new speed control in Settings dialog
  • Added corresponding tests and mocks

Testing

  • Added unit tests for the new feature
  • Manually tested the UI controls and speed adjustment
  • All existing tests pass successfully

Screenshots

image image

Notes

  • The setting is only active in client mode
  • Default speed multiplier is 1.00 (unchanged speed)
  • Changes take effect immediately when adjusted

Related Issues

/claim #7582
Fixes: #7582

Copy link
Copy Markdown
Member

@sithlord48 sithlord48 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small changes to the code are needed
Additionally :Idk how i feel about now adding the appconfig to the server. I have to look but for the other client only options i think we copy into the server config. Honestly it maybe time to for proper client config for per client config.

Copy link
Copy Markdown
Member

@nbolton nbolton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR. Please move the new setting to the 'Advanced' tab.

@sithlord48
Copy link
Copy Markdown
Member

You can not land merges in our history, You must use the rebase option. (tried to disable this but we can only control the option when pr is made from this repo) Please update the pr to have a linear history.

@onyedikachi-david
Copy link
Copy Markdown
Author

You can not land merges in our history, You must use the rebase option. (tried to disable this but we can only control the option when pr is made from this repo) Please update the pr to have a linear history.

Alright.

@onyedikachi-david onyedikachi-david force-pushed the feature/mouse-speed-control branch from e6f5378 to c4c3e0f Compare January 9, 2025 16:05
@onyedikachi-david
Copy link
Copy Markdown
Author

onyedikachi-david commented Jan 9, 2025

Done that, and addressed requested changes.

@sithlord48
Copy link
Copy Markdown
Member

Really sorry about that we do not want the update button to even show but we seam unable to remove it , let alone get it to be the default (i made a request to github about this).

Just be sure to pick in the future to use the "Update With rebase" option if you use the web interface other wise be sure you on current master then git rebase master locally

@onyedikachi-david
Copy link
Copy Markdown
Author

Really sorry about that we do not want the update button to even show but we seam unable to remove it , let alone get it to be the default (i made a request to github about this).

Just be sure to pick in the future to use the "Update With rebase" option if you use the web interface other wise be sure you on current master then git rebase master locally

I actually read that in the wiki, just forgot.

@sithlord48
Copy link
Copy Markdown
Member

Its weird because if i make a Pr coming from deskflow repo the option works but if you make it from a fork it does not. Anyway thanks for understanding.

@sithlord48
Copy link
Copy Markdown
Member

Please do not correct the commit with another commit.

@nbolton
Copy link
Copy Markdown
Member

nbolton commented Jan 10, 2025

Let's keep the commit messages concise too.

@sithlord48
Copy link
Copy Markdown
Member

sithlord48 commented Jan 13, 2025

@onyedikachi-david There is some linting issues as well as needing to be re based , you should include a new argument to the client / server to pass teh value instead or reading the appConfig. (see the Peer ID checking PR i have to see an example of this). Lmk if you like for me to take this over and get it finished up

https://github.com/deskflow/deskflow/pull/7931/files#diff-c75ea1b9ed704f4d35756c678f13076040e421497d9888c45bc8d1d777204f9aR151

https://github.com/deskflow/deskflow/pull/7931/files#diff-b5e336eda6768828be35ab50c9c4fc0d013aa9dc50055f4a7750d32539ac9400R568

Should provide some insite on where to add the option.

@onyedikachi-david
Copy link
Copy Markdown
Author

@onyedikachi-david There is some linting issues as well as needing to be re based , you should include a new argument to the client / server to pass teh value instead or reading the appConfig. (see the Peer ID checking PR i have to see an example of this). Lmk if you like for me to take this over and get it finished up

https://github.com/deskflow/deskflow/pull/7931/files#diff-c75ea1b9ed704f4d35756c678f13076040e421497d9888c45bc8d1d777204f9aR151

https://github.com/deskflow/deskflow/pull/7931/files#diff-b5e336eda6768828be35ab50c9c4fc0d013aa9dc50055f4a7750d32539ac9400R568

Should provide some insite on where to add the option.

I'll try to finish it up before the end of the day. (It's past 7pm here)

@onyedikachi-david onyedikachi-david force-pushed the feature/mouse-speed-control branch 4 times, most recently from 732d4d0 to ee2f778 Compare January 14, 2025 16:57
@onyedikachi-david onyedikachi-david force-pushed the feature/mouse-speed-control branch from ee2f778 to 0a02682 Compare January 14, 2025 17:01
@onyedikachi-david onyedikachi-david force-pushed the feature/mouse-speed-control branch from 0a02682 to da36693 Compare January 15, 2025 07:12
@sithlord48
Copy link
Copy Markdown
Member

Please do not use Merge commits in the PR.

@onyedikachi-david onyedikachi-david force-pushed the feature/mouse-speed-control branch 3 times, most recently from adb27eb to 608cbfa Compare January 15, 2025 16:07
@onyedikachi-david
Copy link
Copy Markdown
Author

@sithlord48 I just addressed the requested changes

Copy link
Copy Markdown
Member

@sithlord48 sithlord48 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Getting there. please use the resolve conversation button when you "fix" a review issue this will make it easier for us to track the changes.

@onyedikachi-david
Copy link
Copy Markdown
Author

rebasing then running .

This Windows test are testing my patience 😂

@onyedikachi-david onyedikachi-david force-pushed the feature/mouse-speed-control branch from 9532d37 to b76aca2 Compare January 29, 2025 13:04
@onyedikachi-david
Copy link
Copy Markdown
Author

Just wish I had a windows laptop to test this before pushing. I apologise for the hassle. @sithlord48 Please rerun. thanks

@onyedikachi-david
Copy link
Copy Markdown
Author

it's an integration test that is failing, and i didn't write any.

./build/bin/integtests
  result=$?
  
  if [ $result -ne 0 ]; then
    echo "Integration tests failed with code: $result" >> $GITHUB_STEP_SUMMARY
  fi

@sithlord48
Copy link
Copy Markdown
Member

you may have changed something for one of the tests @nbolton ?

@nbolton
Copy link
Copy Markdown
Member

nbolton commented Jan 29, 2025

it's an integration test that is failing, and i didn't write any.

you may have changed something for one of the tests @nbolton ?

I'll take a peek

Edit: Error from CI:

[ RUN      ] ServerAppTests.runInner_will_handle_configuration_lifetime
Error: Process completed with exit code 3.

I managed to repro on my Windows dev machine, which shows more detail:

[ RUN      ] ServerAppTests.runInner_will_handle_configuration_lifetime
[2025-01-29T21:44:03] ERROR: the --daemon argument is not supported on windows. instead, install deskflow-server as a service (--service install)
        C:\Projects\deskflow\src\lib\deskflow\ArgParser.cpp:411
Command exited with code 3: ./build/bin/unittests

I'll figure out a fix for you.

Edit 2: I will apply a change

IDK how it passed before but it's late here and I'm too tired to figure out why. It'll no doubt come to me in a dream.

Edit 3: On second thoughts, I found the reason why it's now happening and will highlight it in the review.

@nbolton nbolton self-requested a review January 29, 2025 21:34
@nbolton nbolton force-pushed the feature/mouse-speed-control branch from b76aca2 to d888915 Compare January 29, 2025 21:34
@nbolton
Copy link
Copy Markdown
Member

nbolton commented Jan 29, 2025

Just wish I had a windows laptop to test this before pushing

@onyedikachi-david How about starting a VM and installing Windows? What OS are you on?

Microsoft allows Windows ISO download for free:

@nbolton nbolton force-pushed the feature/mouse-speed-control branch 2 times, most recently from 5174517 to 85884de Compare January 29, 2025 22:15
@nbolton
Copy link
Copy Markdown
Member

nbolton commented Jan 29, 2025

it's an integration test that is failing, and i didn't write any.

It was a unit test that was failing (not an integration test) and it was failing because you added an extra unnecessary call to parseArgs in src/lib/deskflow/ServerApp.cpp for some reason.

Copy link
Copy Markdown
Member

@nbolton nbolton left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's pretty clear this PR has not been tested by the contributor, which is disappointing.

There are also many clumsy and irrelevant changes.

@onyedikachi-david Final warning: I have set this PR to draft. When this PR is next set to open (ready for review), if it is not tested properly, or the next code review is as bad as this one, I will immediately close this PR. We cannot afford the time to babysit bounty PRs.

Edit: I have set this to draft. You can push to your branch but do not reopen this PR until you are 100% certain it is tested, working well, and high quality. Never open a PR with code you haven't tested.

<item>
<widget class="QLabel" name="m_pLabelMouseSpeed">
<property name="text">
<string>Mouse Speed:</string>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think what you had originally makes more sense.

Suggested change
<string>Mouse Speed:</string>
<string>Mouse speed multiplier:</string>

Comment on lines +794 to +796
// parse command line arguments
parseArgs(argc, const_cast<const char *const *>(argv));

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is likely why the integ test was failing.

[ RUN      ] ServerAppTests.runInner_will_handle_configuration_lifetime
[2025-01-29T21:44:03] ERROR: the --daemon argument is not supported on windows. instead, install deskflow-server as a service (--service install)
        C:\Projects\deskflow\src\lib\deskflow\ArgParser.cpp:411
Command exited with code 3: ./build/bin/unittests

Why are you calling this here? Please remove it.

Suggested change
// parse command line arguments
parseArgs(argc, const_cast<const char *const *>(argv));

This is why you need to be able to run the tests locally on a Windows dev machine before setting the PR to open and asking for a review.

args << "--tls-cert" << m_appConfig.tlsCertPath();
}

// Add mouse speed argument if not default value
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please do not add comments explaining how the code works. Only add comments when you need to explain why you're doing something, which should be somewhat rare.

Suggested change
// Add mouse speed argument if not default value

Comment on lines +36 to +37
m_events(events),
m_mouseSpeed(1.0)
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary, already using default init.

Suggested change
m_events(events),
m_mouseSpeed(1.0)
m_events(events)

bool m_hasLockToScreenAction;
IEventQueue *m_events;
std::string m_ClientAddress;
double m_mouseSpeed = 1.0; // Default mouse speed
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Redundant comment.

Suggested change
double m_mouseSpeed = 1.0; // Default mouse speed
double m_mouseSpeed = 1.0;

LOG((CLOG_DEBUG1 "DESKFLOW_MOUSE_ADJUSTMENT not set, using original values %+d,%+d", dx, dy));
}

// adjust mouse speed using server config
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
// adjust mouse speed using server config

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of the changes in this file should be necessary, please revert.

Comment on lines +30 to +43
EXPECT_FALSE(app.args().m_config);
// Initially config should be set but with test values
EXPECT_TRUE(app.args().m_config);
EXPECT_NEAR(1.0, app.args().m_config->mouseSpeed(), 1e-10);

const char *argv[]{"deskflow-server"};
app.runInner(1, const_cast<char **>(argv), nullptr, [](int, char **) { return 0; });

// After runInner, config should still be properly initialized
EXPECT_TRUE(app.args().m_config);
EXPECT_NEAR(1.0, app.args().m_config->mouseSpeed(), 1e-10);
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I cannot see how any of this change is necessary or useful. Please revert this.

@nbolton

This comment was marked as duplicate.

@nbolton nbolton marked this pull request as draft January 29, 2025 22:42
@onyedikachi-david onyedikachi-david force-pushed the feature/mouse-speed-control branch from 85884de to eb05f93 Compare February 1, 2025 02:25
@sithlord48 sithlord48 force-pushed the feature/mouse-speed-control branch from eb05f93 to 0e9b1d1 Compare February 1, 2025 18:06
@sithlord48
Copy link
Copy Markdown
Member

rebasing and running .

@onyedikachi-david onyedikachi-david force-pushed the feature/mouse-speed-control branch from 0e9b1d1 to 3e15c42 Compare February 4, 2025 18:00
@onyedikachi-david
Copy link
Copy Markdown
Author

I'm sorry for keeping this on draft this long, although all the CI passed before the current conflict, I left it in draft because I wanted to demo it locally on a windows OS, had some issues with it (dependencies issues) while building. I tried alternative ways to do that but, the windows laptop isn't always with me, being a friends own; I have an M1 air, 256gb, with more than 85% disk usage, so can't run a VM on it as suggested by @nbolton. Hence I can not demo a working implementation on windows OS.

Last week i tried resolving the conflicts, noticed that alot of renaming was done, making it difficult to resolve them, each resolve results to another conflicts.

I am suggesting to open another PR for a cleaner merge. Is that okay with you @sithlord48 .

@sithlord48
Copy link
Copy Markdown
Member

sithlord48 commented Feb 15, 2025

I would prefer to keep the history all in this one place if you can
@onyedikachi-david I have rebased this for you on your local copy do a git pull --rebase .

@sithlord48 sithlord48 force-pushed the feature/mouse-speed-control branch from 3e15c42 to 0bd966d Compare February 15, 2025 22:02
@onyedikachi-david onyedikachi-david force-pushed the feature/mouse-speed-control branch from 0ddec7a to 0bd966d Compare March 4, 2025 09:44
@nbolton
Copy link
Copy Markdown
Member

nbolton commented Mar 14, 2025

Unfortunately, as this PR is taking too much of our time, I must close it. I am also removing the bounty from the issue. Thanks for your effort.

@nbolton nbolton closed this Mar 14, 2025
@onyedikachi-david
Copy link
Copy Markdown
Author

@nbolton. Kinda sad though, but it was quite a learning experience nevertheless, I use my contributions to open source repo to both improve on my skills and up my hiring chance, thanks for the review and all. I'll do better when chanced to contribute again.

@nbolton
Copy link
Copy Markdown
Member

nbolton commented Mar 24, 2025

@nbolton. Kinda sad though, but it was quite a learning experience nevertheless, I use my contributions to open source repo to both improve on my skills and up my hiring chance, thanks for the review and all. I'll do better when chanced to contribute again.

I'd be glad to see a new PR once you have a bit more C++ experience. Good luck with your learning journey!

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.

Client mouse adjustment setting in GUI

3 participants