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

Distinguish between virtual input and human input #461

Open
freakzbc opened this issue Apr 10, 2024 · 5 comments
Open

Distinguish between virtual input and human input #461

freakzbc opened this issue Apr 10, 2024 · 5 comments
Milestone

Comments

@freakzbc
Copy link

Key sources include real human keyboard input and java.awt.Robot virtual input. How do I distinguish them when using keyListener?

I tried to distinguish by these properties, but they are the same in both cases.

    public void nativeKeyPressed(NativeKeyEvent e) {

        System.out.println("--------------------------");
        System.out.println(e.getKeyCode());
        System.out.println(e.getKeyLocation());
        System.out.println(e.getWhen());
        System.out.println(e.getKeyChar());
        System.out.println(e.getSource());
        System.out.println(e.getID());
        System.out.println(e.getModifiers());
        System.out.println(e.getRawCode());
        System.out.println("==========================");
    }
@kwhat
Copy link
Owner

kwhat commented Apr 26, 2024

This has been resolved upstream and will be available in 2.3

@kwhat kwhat added this to the 2.3.0 milestone Apr 26, 2024
@wysnxzm
Copy link

wysnxzm commented Sep 25, 2024

This has been resolved upstream and will be available in 2.3

I really need this feature, waiting for you

@kwhat
Copy link
Owner

kwhat commented Sep 25, 2024

Unfortunately there is only one of me. Some code to do this has been committed upstream but I haven't figured out how I am going to integrate it. Most of my time is being spent on the dumpster fire that is Wayland and the 1000s of lines of code it takes to figure out the simplest of things like the x,y coordinates of the mouse.

I could probably make some preview release of 2.3 if that would help. They wont be in Maven Central, but you could use them locally.

Let me know.

@wysnxzm
Copy link

wysnxzm commented Sep 25, 2024

Unfortunately there is only one of me. Some code to do this has been committed upstream but I haven't figured out how I am going to integrate it. Most of my time is being spent on the dumpster fire that is Wayland and the 1000s of lines of code it takes to figure out the simplest of things like the x,y coordinates of the mouse.

I could probably make some preview release of 2.3 if that would help. They wont be in Maven Central, but you could use them locally.

Let me know.

You can try to find some inspiration in autohotkey. In fact, I have raised similar questions and suggestions before.

@kwhat
Copy link
Owner

kwhat commented Sep 25, 2024

You can try to find some inspiration in autohotkey. In fact, I have raised similar questions and suggestions before.

I've read though their code and I've got a working libevent implantation, the hard parts are the bits around the edges like absolute mouse position, language support, monitor count and configuration. Simple things like getting the mouse double click interval are literally impossible on Wayland. GTK has a proprietary value, but KDE does not and trying to support the 9+ compositors that currently exist is next to impossible.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants