public class GlobalShortcutServiceImpl extends java.lang.Object implements GlobalShortcutService, NativeKeyboardHookDelegate
SPECIAL_KEY_MODIFIERS
MODIFIERS_ALT, MODIFIERS_CTRL, MODIFIERS_LOGO, MODIFIERS_SHIFT
Constructor and Description |
---|
GlobalShortcutServiceImpl()
Initializes the GlobalShortcutServiceImpl.
|
Modifier and Type | Method and Description |
---|---|
CallShortcut |
getCallShortcut()
Returns CallShortcut object.
|
java.awt.AWTKeyStroke |
getSpecialKey()
Get special keystroke or null if not supported or user cancels.
|
UIShortcut |
getUIShortcut()
Returns UIShortcut object.
|
void |
receiveKey(int keycode,
int modifiers,
boolean onRelease)
Receive a key press event.
|
void |
registerShortcut(GlobalShortcutListener listener,
java.awt.AWTKeyStroke keyStroke)
Registers an action to execute when the keystroke is typed.
|
void |
registerShortcut(GlobalShortcutListener listener,
java.awt.AWTKeyStroke keyStroke,
boolean add)
Registers an action to execute when the keystroke is typed.
|
void |
reloadGlobalShortcuts()
Reload global shortcuts.
|
void |
setEnable(boolean enable)
Enable or not global shortcut.
|
void |
setSpecialKeyDetection(boolean enable,
GlobalShortcutListener callback)
Enable or disable special key detection.
|
void |
start()
Start the service.
|
void |
stop()
Stop the service.
|
void |
test()
Simple test.
|
void |
unregisterShortcut(GlobalShortcutListener listener,
java.awt.AWTKeyStroke keyStroke)
Unregisters an action to execute when the keystroke is typed.
|
void |
unregisterShortcut(GlobalShortcutListener listener,
java.awt.AWTKeyStroke keyStroke,
boolean remove)
Unregisters an action to execute when the keystroke is typed.
|
public GlobalShortcutServiceImpl()
public void registerShortcut(GlobalShortcutListener listener, java.awt.AWTKeyStroke keyStroke)
registerShortcut
in interface GlobalShortcutService
listener
- listener to notify when keystroke is typedkeyStroke
- keystroke that will trigger the actionpublic void registerShortcut(GlobalShortcutListener listener, java.awt.AWTKeyStroke keyStroke, boolean add)
listener
- listener to notify when keystroke is typedkeyStroke
- keystroke that will trigger the actionadd
- add the listener/keystrokes to mappublic void unregisterShortcut(GlobalShortcutListener listener, java.awt.AWTKeyStroke keyStroke)
unregisterShortcut
in interface GlobalShortcutService
listener
- listener to removekeyStroke
- keystroke that will trigger the actionpublic void unregisterShortcut(GlobalShortcutListener listener, java.awt.AWTKeyStroke keyStroke, boolean remove)
listener
- listener to removekeyStroke
- keystroke that will trigger the actionremove
- remove or not entry in the mappublic void start()
public void stop()
public void receiveKey(int keycode, int modifiers, boolean onRelease)
receiveKey
in interface NativeKeyboardHookDelegate
keycode
- keycode receivedmodifiers
- modifiers received (ALT or CTRL + letter, ...)isOnKeyRelease
- this parameter is true if the shortcut is releasedpublic void reloadGlobalShortcuts()
reloadGlobalShortcuts
in interface GlobalShortcutService
public CallShortcut getCallShortcut()
public UIShortcut getUIShortcut()
public void setEnable(boolean enable)
setEnable
in interface GlobalShortcutService
enable
- enable or not global shortcutpublic void setSpecialKeyDetection(boolean enable, GlobalShortcutListener callback)
setSpecialKeyDetection
in interface GlobalShortcutService
enable
- enable or not special key detection.callback
- object to be notifiedpublic java.awt.AWTKeyStroke getSpecialKey()
getSpecialKey
in interface GlobalShortcutService
public void test()
Jitsi, the OpenSource Java VoIP and Instant Messaging client.
Distributable under Apache license.