Giter VIP home page Giter VIP logo

Comments (4)

justdie386 avatar justdie386 commented on May 27, 2024 1

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.

kwhat avatar kwhat commented on May 27, 2024

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.

LightCannon avatar LightCannon commented on May 27, 2024

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.

justdie386 avatar justdie386 commented on May 27, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.