-
Notifications
You must be signed in to change notification settings - Fork 75
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
Implement mouse and monitor functionality for X11 & Mac OS #140
Conversation
- Add new 'dragonfly/actions/mouse' sub-package similar to the 'keyboard' sub-package. - Add pynput as a Linux requirement in setup.py. - Move all internal mouse event classes, flags and functions into modules under the new 'mouse' sub-package. - Add pynput mouse implementation for X11 (Linux) and Mac OS. - Unmock the Mouse action.
- Move most monitor code into BaseMonitor class. - Put Windows code in Win32Monitor sub-class & confirm it works. - Put X11 boilerplate code in place (not implemented yet). - Adjust a few modules to import the monitor list and class for the current platform. - Remove monitor-related mocking.
I've moved monitor code into some new modules, added boilerplate code for All I should have to do now is parse output from The |
Getting the list of monitors seems to be pretty easy with
|
These functions should work with each Window implementation once the Monitor classes are implemented. This commit also adds docstrings for each method.
AppKit doesn't currently update monitor information after it is retrieved, so the interpreter needs to be restarted after each monitor change.
- Add pyobjc as a required package on Mac OS (for AppKit). - Keep platform dependencies separate in setup.py.
Like the Windows class, both of these implementations put the primary monitor first on the list. This affects where the mouse will move when using absolute movements (e.g. The |
- Add FakeMonitor class and import it on unsupported platforms. - Add Monitor.get_monitor() class method. - Add read-only, self updating MonitorList class. - Make the global 'monitors' list an instance of MonitorList. - Replace update_monitors_list() with get_all_monitors() and implement it for each platform.
ad5d65f
to
528c1ed
Compare
This is ready to be merged now. The There are two new class methods:
These are based on similar methods in Dragonfly's A |
Re: #8.
This PR implements mouse support for Linux and Mac OS via
pynput
.I've moved all internal mouse event classes, flags and functions into modules under a new
dragonfly/actions/mouse
sub-package, similar to thekeyboard
sub-package. Windows functionality should be completely unaffected by these changes. From my testing, it seems to work just as it did before.Mouse button and scroll events all work in X11.
pynput
doesn't seem to support scrolling or the"four"
/"five"
buttons on Mac OS. The"left"
,"right"
and"middle"
buttons seem to work properly though.I won't merge this just yet because I want to get the
Monitor
class working on Linux so that relative mouse movements work correctly.Mouse movements do not yet work properly on Mac OS because we don't have a
Window
class for that platform. That can wait for another day because I'm not very familiar with the Mac OS APIs.