kwhat / jnativehook

Global keyboard and mouse listeners for Java.
Other
1.75k stars 348 forks source link

Cant Detect Extra Mouse Buttons 8 and 9 as a Key. #341

Closed MahdeenSky closed 2 years ago

MahdeenSky commented 3 years ago

I'm trying to bind it to mouse buttons 8 and 9, which is easily detected by firefox, but not by the application. I found they are buttons 8 and 9 through xev.

xplatform-dev commented 3 years ago

There is not support for mouse buttons above 5. Your mouse might be registering the scroll wheel as 6 and 7 but those are mouse wheel events. See jni.include.org_jnativehook_mouse_NativeMouseEvent.h, libuiohook.include.uiohook.h, and java.org.jnativehook.mouse.NativeMouseEvents.java. All 3 of these files would need to be updated to suit your needs.

These are also most likely programmable macros which are usually broken up into their own events - and looking at the other comments here, I would try disabling the logger to reduce the performance impact that it has in attempt to capture the macros. I have personally played games not be able to register the inputs from a pre-configured macro that came with the mouse's software.

kwhat commented 3 years ago

Just to shed a little light on this, the reason that mouse buttons above 5 are not supported is because OSX barely supports 4 & 5. I don't think windows does either, at least without some helper software. X11 will support 10 IIRC, but who cares about Linux.

kwhat commented 2 years ago

We maybe able to resolve this with a small patch here and here. I think we can just do something like button = map_button; in the default case but there isn't anyway I am going to be able to test this.

@MahdeenSky What mouse do you have that can generate mouse button 8 & 9?

MahdeenSky commented 2 years ago

We maybe able to resolve this with a small patch here and here. I think we can just do something like button = map_button; in the default case but there isn't anyway I am going to be able to test this.

@MahdeenSky What mouse do you have that can generate mouse button 8 & 9?

the razer essential mouse

kwhat commented 2 years ago

Alright I looked into this and 8 & 9 should be the side buttons on the Razer and should be handled by XButton1 & XButton2. I made some changes to the way buttons were translated recently and these appear to working for me in the latest snapshot.

Let me know if you are still having an issue and I can look into this further.