Comments (4)
I have wrote a function to get the x and y of the mouse for macos windows and x11 so that i could use it with libuiohook i could show the code here. Not sure how good it is but it seems to work fine when i tested it.
from libuiohook.
problem: QCursor.setPos does not trigger any mouse move event. This solution would have been ideal if this was not happening.
What OS is this happening on? I suspect it is Linux and that is a rather long conversation I don't want to type yet... You should try this on all 3 supported platforms, it will likely work on windows, macOS is a 50/50 but I suspect this works as well.
I will use your library to send mouse press/releases
This is the ideal solution as the library should see it's own generated events.
coordinates are not dpi aware, and has problems when multiple monitors are connected.
Please explain this part further... I don't quite understand why/how this is an issue. I don't have an issues with multiple monitors but many others have expressed frustration.
Find some way to get the mouse position without listening to event, and I will use that in the event when I press.
This is possible on all platforms, I just don't know the exact API for windows and macOS. In X11, the API is XQueryPointer and there are examples on how to use it.
from libuiohook.
I have wrote a function to get the x and y of the mouse for macos windows and x11 so that i could use it with libuiohook i could show the code here. Not sure how good it is but it seems to work fine when i tested it.
Could you share it?
from libuiohook.
Ignore all the other files, all you'll need is in the osx, win32, and x11 folders https://github.com/justdie386/luaohook/tree/main/src/mouse
i made some #define to make the data type different depending on each platform, the code might not be the most optimized, or the way files are placed too, idk, im quite far from being proficient in C. There could be better ways for the x11 to do it but the osx and win32 are I think the bare minimum to work.
#ifdef _WIN32
#include <windows.h>
#include <winuser.h>
#include "win32/win32.h"
#define coords POINT
#elif __APPLE__
#include <unistd.h>
#include "osx/osx.h"
#define coords CGPoint
#else
#include <unistd.h>
#include "x11/x11.h"
#define coords MouseCoordinates
#endif
from libuiohook.
Related Issues (20)
- Can't type special characters with right alt HOT 3
- replace key ouput with other value HOT 11
- Caps lock can't be suppressed on Mac OS Monterey HOT 1
- Posting Keys Does Not Work in Games on Windows
- KeyTyped event wasn't emitted for @ on German keyboard layout HOT 10
- hook_create_screen_info doesn't work correctly on Windows when there are multiple screens HOT 1
- Darwin Segfualt on CGEventTapCreate failure
- [Feature Request] Add support for Mac Catalyst HOT 8
- Address issues with Windows hook restarts HOT 2
- coordinates multiplied by two for the mouse on windows HOT 9
- error in the readme HOT 1
- Add keychar support to press and release HOT 2
- Remap a keyboard key as a left mouse button unable to register a double click HOT 1
- add libuiohook as a package on xmake-repo HOT 2
- `keycode` does not match (all?) definitions from `uiohook.h` on Windows HOT 7
- Help for Compiling on Windows HOT 3
- The KEYEVENTF_EXTENDEDKEY flag is not added to every key that needs it when simulating keyboard events on Windows HOT 4
- Deadlock when used with NodeJS NAPI module HOT 1
- Remove USE_XRECORD_ASYNC build flag.
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from libuiohook.