melloware / jintellitype

JIntellitype is a Java API for interacting with Microsoft Intellitype commands as well as registering for Global Hotkeys in your Java application.
Apache License 2.0
171 stars 42 forks source link

The registration button is invalid in full-screen mode #43

Open ShipinZ opened 3 years ago

ShipinZ commented 3 years ago

Is there a solution to the failure of registration buttons in full screen mode, such as in LOL

melloware commented 3 years ago

Can you elaborate what registration button?

ShipinZ commented 3 years ago

OS: Windwows11 JDK: 16 code:

import com.melloware.jintellitype.HotkeyListener;
import com.melloware.jintellitype.JIntellitype;

public class Main {
    private static final int HOME = 96;

    public static void main(String[] args){
        JIntellitype instance = JIntellitype.getInstance();
        String k = "home";
        instance.registerHotKey(HOME,k);
        instance.addHotKeyListener(new HotkeyListener() {
            int i = 1;
            @Override
            public void onHotKey(int identifier) {
                if(identifier == HOME) {
                    System.out.printf("Press Home %d times\n", i++);
                }
            }
        });

    }
}

It works fine until lol is in full screen, but it doesn't work when lol is in full screen. I tried LOL without borders, but it didn't work. Since I just started using it, I'm not sure if there is a problem with my code writing

melloware commented 3 years ago

oh maybe in Full Screen Windows 11 is intercepting the HOME key before it gets to JIntellitype? I have noticed Windows 10 and 11 are a lot more aggressive with their key intercepting.

ShipinZ commented 3 years ago

oh maybe in Full Screen Windows 11 is intercepting the HOME key before it gets to JIntellitype? I have noticed Windows 10 and 11 are a lot more aggressive with their key intercepting. I've tried running Java programs as an administrator, but nothing

melloware commented 3 years ago

Administrator won't help. The HOME key might be special for Full Screen Mode and Microsoft owns the keys before they get to JIntellitype. Have you tried another key like S or A to see if it works in Full Screen? Just trying to figure out if the HOME key is special or FullScreen blocks ALL hotkeys from getting to Jintellitype.

melloware commented 3 years ago

cc @RocketMaDev in case you have any thoughts?

ShipinZ commented 3 years ago

Administrator won't help. The HOME key might be special for Full Screen Mode and Microsoft owns the keys before they get to JIntellitype. Have you tried another key like S or A to see if it works in Full Screen? Just trying to figure out if the HOME key is special or FullScreen blocks ALL hotkeys from getting to Jintellitype.

I just tried the following buttons, but the problem is the same as before, it doesn't work in full screen mode

import com.melloware.jintellitype.HotkeyListener;
import com.melloware.jintellitype.JIntellitype;

import java.util.HashMap;
import java.util.Map;

public class Main {
    private static final int N = 90;
    private static final int CTRL_N = 91;
    private static final int CTRL_ALT_N = 92;
    private static final int K = 93;
    private static final int CTRL_K = 94;
    private static final int CTRL_ALT_K = 95;
    private static final int L = 96;
    private static final int CTRL_L = 97;
    private static final int CTRL_ALT_L = 98;
    private static final int HOME = 99;

    private static Map<Integer,String> map = new HashMap<>(16);
    static {
        map.put(N,"N");
        map.put(CTRL_N,"CTRL+N");
        map.put(CTRL_ALT_N,"CTRL+ALT+N");
        map.put(K,"K");
        map.put(CTRL_K,"CTRL+K");
        map.put(CTRL_ALT_K,"CTRL+ALT+K");
        map.put(L,"L");
        map.put(CTRL_L,"CTRL+L");
        map.put(CTRL_ALT_L,"CTRL+ALT+L");
        map.put(HOME,"HOME");
    }

    public static void main(String[] args){
        JIntellitype instance = JIntellitype.getInstance();
        map.forEach(instance::registerHotKey);
        instance.addHotKeyListener(new HotkeyListener() {
            int i = 1;
            @Override
            public void onHotKey(int identifier) {
                System.out.printf("Press %s %d times\n",map.get(identifier), i++);
            }
        });

    }
}
melloware commented 3 years ago

Then my guess is Microsoft is blocking it then.

RocketMaDev commented 3 years ago

According to the fact that the library functions through a visible, I think it happens because an app in full screen mode will cover it.
Please try if it works in other apps.

Xiaobaishushu25 commented 2 years ago

Is there a solution to the failure of registration buttons in full screen mode, such as in LOL

Hello, does it only fail when you are in full screen?I find that when I open the LOL client and put it at the front of the desktop, the shortcut doesn't work