diff options
author | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-26 00:30:14 +0200 |
---|---|---|
committer | hannibal2 <24389977+hannibal00212@users.noreply.github.com> | 2023-10-26 00:30:14 +0200 |
commit | 0268bdc1a27fe9a037fa4d10fe839d4d24891b5f (patch) | |
tree | fb0a398a948839aa066127a07d2f48b6ecdc58d5 /src/main/java | |
parent | cab7522665f1de2e72fd0bb785a7741e9b3278c1 (diff) | |
download | skyhanni-0268bdc1a27fe9a037fa4d10fe839d4d24891b5f.tar.gz skyhanni-0268bdc1a27fe9a037fa4d10fe839d4d24891b5f.tar.bz2 skyhanni-0268bdc1a27fe9a037fa4d10fe839d4d24891b5f.zip |
code cleanup
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 +} |