diff options
Diffstat (limited to 'src/main/java')
-rw-r--r-- | src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt | 14 |
1 files changed, 5 insertions, 9 deletions
diff --git a/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt b/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt index a1fac5387..d750b7696 100644 --- a/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt +++ b/src/main/java/at/hannibal2/skyhanni/utils/KeyboardManager.kt @@ -17,15 +17,11 @@ object KeyboardManager { fun isControlKeyDown() = Keyboard.KEY_LCONTROL.isKeyHeld() || Keyboard.KEY_RCONTROL.isKeyHeld() fun isShiftKeyDown() = Keyboard.KEY_LSHIFT.isKeyHeld() || Keyboard.KEY_RSHIFT.isKeyHeld() - fun isPastingKeysDown(): Boolean { - val modifierHeld = if (SystemUtils.IS_OS_MAC) isCommandKeyDown() else isControlKeyDown() - return modifierHeld && Keyboard.KEY_V.isKeyHeld() - } + fun isPastingKeysDown() = isModifierHeld() && Keyboard.KEY_V.isKeyHeld() - fun isCopyingKeysDown(): Boolean { - val modifierHeld = if (SystemUtils.IS_OS_MAC) isCommandKeyDown() else isControlKeyDown() - return modifierHeld && Keyboard.KEY_C.isKeyHeld() - } + fun isCopyingKeysDown() = isModifierHeld() && Keyboard.KEY_C.isKeyHeld() + + private fun isModifierHeld() = if (SystemUtils.IS_OS_MAC) isCommandKeyDown() else isControlKeyDown() @SubscribeEvent fun onTick(event: LorenzTickEvent) { @@ -79,4 +75,4 @@ object KeyboardManager { } fun getKeyName(keyCode: Int): String = KeybindHelper.getKeyName(keyCode) -}
\ No newline at end of file +} |