Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multi monitor support for mouseMove and dragMouse #307

Merged
merged 2 commits into from
Nov 24, 2019

Conversation

hristoterezov
Copy link
Contributor

@hristoterezov hristoterezov commented Jun 30, 2017

If the user has more than 1 monitor the coordinates of a monitor can be negative. Before the PR all the parameters for mouseMove and dragMouse were using size_t which is unsigned. That's why it was not possible to pass negative coordinates and move the mouse to a monitor with negative coordinates.

Fix #88

@octalmage
Copy link
Owner

This is awesome! Thank you! I'll take a look this weekend.

@jareddgotte
Copy link

@hristoterezov Nice! Have you made any updates since this PR? I'm interested in getting getPixelColor() working across multiple monitors, too. It looks like the bitmap_find.c/h, color_find.c/h, MMPointArray.c/h, and screen.c/h files all use MMPoint, as well.

@octalmage
Copy link
Owner

Sorry everyone, releasing and building is currently difficult since I have to spin up a bunch of VMs. I'm going to work on getting TravisCI publishing so it's easier to test and deploy. Thanks for the PR!

@YanDevDe
Copy link

YanDevDe commented Mar 27, 2018

But I think negative mouse position is actually normal. It depends where your primary monitor is. If your primary monitor is in middle between two monitors from left and right, then the mouse position on this primary monitor starts at 0x 0y from top left which this make more sense. So it's already fine.

However, it would be good if this can be changed per settings. Such like:

var robot = require("robotjs");
robot.removeNegativeMousePosition(true);

or something like this. The main reason is that many applications works already pretty fine with negative mouse positions and changing the mouse position logic will just cause more problems.

The only thing which needs to change is that getPixelColor() support negative mouse position, too.

@hristoterezov
Copy link
Contributor Author

@jareddgotte Sorry for the delayed response! I haven't made any other changes after the PR and also nothing related to the getPixelColor.

@hristoterezov
Copy link
Contributor Author

@chinafreak I'm a little confused from your comment and here is why:

  1. If you pass negative coordinates to mouseMove and dragMouse on the code before my change, it won't work properly. The purpose of my PR is to fix this.
  2. I don't understand why would you need removeNegativeMousePosition(true);. I don't think that the code without my fix will work "pretty fine" with negative mouse position. Actually I think it won't work! But after my changes it is supposed to work with negative mouse position!
  3. "changing the mouse position logic will just cause more problems" - The consumers of the library won't need to change anything. Basically before the PR the multi monitor use case was not working and after the PR it will start working.
  4. I don't think getPixelColor() is related to my PR.

Could you please explain what you mean with your comment? Am I missing something?

@YanDevDe
Copy link

YanDevDe commented Jun 28, 2018

@hristoterezov

Hey sorry, I just read your issue again and I think I misunderstood it. I think I thought you wanted to remove negative mouse position. I'm not even sure if I wrote this on wrong issue, because it was so long time ago.

Indeed, but getPixelColor() doesnt work for negative values too.

@mnakkara
Copy link

mnakkara commented Oct 3, 2018

@hristoterezov @octalmage Any updates on this? I see this is in PR for over a year. It would be awesome if we can get this in a new release soon.

@johndatserakis
Copy link

johndatserakis commented Mar 15, 2019

@octalmage any word on this pr - looks like myself and a few others have been waiting for it for coming up on 2 years now - support for multiple monitors would be great, and @hristoterezov mentioned that the fix doesn't really effect other parts of the code. Any status?

@saghul
Copy link

saghul commented May 8, 2019

@octalmage Hey there! Is there anything we can do to help this one land? Not needing to rely on a fork would be ideal for us (Jitsi).

@oktapodia
Copy link
Collaborator

Thank you for your PR!

@oktapodia oktapodia merged commit f0efcd1 into octalmage:master Nov 24, 2019
@saghul
Copy link

saghul commented Nov 26, 2019

Thanks a lot @oktapodia! Any rough estimation on when this could make it into a release?

@csett86 csett86 deleted the multi_monitor branch November 11, 2021 22:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[multi-monitor] moveMouse wont move to negative position on mac
8 participants