diff --git a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/KeyMapping.kt b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/KeyMapping.kt index 57c2f85eecb2f..fefd6f358c2c1 100644 --- a/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/KeyMapping.kt +++ b/compose/foundation/foundation/src/commonMain/kotlin/androidx/compose/foundation/text/KeyMapping.kt @@ -16,6 +16,7 @@ package androidx.compose.foundation.text +import androidx.compose.foundation.text.MappedKeys import androidx.compose.ui.input.key.Key import androidx.compose.ui.input.key.KeyEvent import androidx.compose.ui.input.key.isAltPressed @@ -42,15 +43,24 @@ internal expect object MappedKeys { val Z: Key val Backslash: Key val DirectionLeft: Key + val NumPadDirectionLeft: Key val DirectionRight: Key + val NumPadDirectionRight: Key val DirectionUp: Key + val NumPadDirectionUp: Key val DirectionDown: Key + val NumPadDirectionDown: Key val DirectionCenter: Key val PageUp: Key + val NumPadPageUp: Key val PageDown: Key + val NumPadPageDown: Key val MoveHome: Key + val NumPadMoveHome: Key val MoveEnd: Key + val NumPadMoveEnd: Key val Insert: Key + val NumPadInsert: Key val Enter: Key val NumPadEnter: Key val Backspace: Key @@ -74,7 +84,8 @@ internal fun commonKeyMapping(shortcutModifier: (KeyEvent) -> Boolean): KeyMappi shortcutModifier(event) -> when (event.key) { MappedKeys.C, - MappedKeys.Insert -> KeyCommand.COPY + MappedKeys.Insert, + MappedKeys.NumPadInsert -> KeyCommand.COPY MappedKeys.V -> KeyCommand.PASTE MappedKeys.X -> KeyCommand.CUT MappedKeys.A -> KeyCommand.SELECT_ALL @@ -85,28 +96,45 @@ internal fun commonKeyMapping(shortcutModifier: (KeyEvent) -> Boolean): KeyMappi event.isCtrlPressed -> null event.isShiftPressed -> when (event.key) { - MappedKeys.DirectionLeft -> KeyCommand.SELECT_LEFT_CHAR - MappedKeys.DirectionRight -> KeyCommand.SELECT_RIGHT_CHAR - MappedKeys.DirectionUp -> KeyCommand.SELECT_UP - MappedKeys.DirectionDown -> KeyCommand.SELECT_DOWN - MappedKeys.PageUp -> KeyCommand.SELECT_PAGE_UP - MappedKeys.PageDown -> KeyCommand.SELECT_PAGE_DOWN - MappedKeys.MoveHome -> KeyCommand.SELECT_LINE_START - MappedKeys.MoveEnd -> KeyCommand.SELECT_LINE_END - MappedKeys.Insert -> KeyCommand.PASTE + MappedKeys.DirectionLeft, + MappedKeys.NumPadDirectionLeft -> KeyCommand.SELECT_LEFT_CHAR + MappedKeys.DirectionRight, + MappedKeys.NumPadDirectionRight -> KeyCommand.SELECT_RIGHT_CHAR + MappedKeys.DirectionUp, + MappedKeys.NumPadDirectionUp -> KeyCommand.SELECT_UP + MappedKeys.DirectionDown, + MappedKeys.NumPadDirectionDown -> KeyCommand.SELECT_DOWN + MappedKeys.PageUp, + MappedKeys.NumPadPageUp -> KeyCommand.SELECT_PAGE_UP + MappedKeys.PageDown, + MappedKeys.NumPadPageDown -> KeyCommand.SELECT_PAGE_DOWN + MappedKeys.MoveHome, + MappedKeys.NumPadMoveHome -> KeyCommand.SELECT_LINE_START + MappedKeys.MoveEnd, + MappedKeys.NumPadMoveEnd -> KeyCommand.SELECT_LINE_END + MappedKeys.Insert, + MappedKeys.NumPadInsert -> KeyCommand.PASTE else -> null } else -> when (event.key) { - MappedKeys.DirectionLeft -> KeyCommand.LEFT_CHAR - MappedKeys.DirectionRight -> KeyCommand.RIGHT_CHAR - MappedKeys.DirectionUp -> KeyCommand.UP - MappedKeys.DirectionDown -> KeyCommand.DOWN + MappedKeys.DirectionLeft, + MappedKeys.NumPadDirectionLeft -> KeyCommand.LEFT_CHAR + MappedKeys.DirectionRight, + MappedKeys.NumPadDirectionRight -> KeyCommand.RIGHT_CHAR + MappedKeys.DirectionUp, + MappedKeys.NumPadDirectionUp -> KeyCommand.UP + MappedKeys.DirectionDown, + MappedKeys.NumPadDirectionDown -> KeyCommand.DOWN MappedKeys.DirectionCenter -> KeyCommand.CENTER - MappedKeys.PageUp -> KeyCommand.PAGE_UP - MappedKeys.PageDown -> KeyCommand.PAGE_DOWN - MappedKeys.MoveHome -> KeyCommand.LINE_START - MappedKeys.MoveEnd -> KeyCommand.LINE_END + MappedKeys.PageUp, + MappedKeys.NumPadPageUp -> KeyCommand.PAGE_UP + MappedKeys.PageDown, + MappedKeys.NumPadPageDown -> KeyCommand.PAGE_DOWN + MappedKeys.MoveHome, + MappedKeys.NumPadMoveHome -> KeyCommand.LINE_START + MappedKeys.MoveEnd, + MappedKeys.NumPadMoveEnd -> KeyCommand.LINE_END MappedKeys.Enter, MappedKeys.NumPadEnter -> KeyCommand.NEW_LINE MappedKeys.Backspace -> KeyCommand.DELETE_PREV_CHAR @@ -130,18 +158,26 @@ internal val defaultKeyMapping: KeyMapping = return when { event.isShiftPressed && event.isCtrlPressed -> when (event.key) { - MappedKeys.DirectionLeft -> KeyCommand.SELECT_LEFT_WORD - MappedKeys.DirectionRight -> KeyCommand.SELECT_RIGHT_WORD - MappedKeys.DirectionUp -> KeyCommand.SELECT_PREV_PARAGRAPH - MappedKeys.DirectionDown -> KeyCommand.SELECT_NEXT_PARAGRAPH + MappedKeys.DirectionLeft, + MappedKeys.NumPadDirectionLeft -> KeyCommand.SELECT_LEFT_WORD + MappedKeys.DirectionRight, + MappedKeys.NumPadDirectionRight -> KeyCommand.SELECT_RIGHT_WORD + MappedKeys.DirectionUp, + MappedKeys.NumPadDirectionUp -> KeyCommand.SELECT_PREV_PARAGRAPH + MappedKeys.DirectionDown, + MappedKeys.NumPadDirectionDown -> KeyCommand.SELECT_NEXT_PARAGRAPH else -> null } event.isCtrlPressed -> when (event.key) { - MappedKeys.DirectionLeft -> KeyCommand.LEFT_WORD - MappedKeys.DirectionRight -> KeyCommand.RIGHT_WORD - MappedKeys.DirectionUp -> KeyCommand.PREV_PARAGRAPH - MappedKeys.DirectionDown -> KeyCommand.NEXT_PARAGRAPH + MappedKeys.DirectionLeft, + MappedKeys.NumPadDirectionLeft -> KeyCommand.LEFT_WORD + MappedKeys.DirectionRight, + MappedKeys.NumPadDirectionRight -> KeyCommand.RIGHT_WORD + MappedKeys.DirectionUp, + MappedKeys.NumPadDirectionUp -> KeyCommand.PREV_PARAGRAPH + MappedKeys.DirectionDown, + MappedKeys.NumPadDirectionDown -> KeyCommand.NEXT_PARAGRAPH MappedKeys.H -> KeyCommand.DELETE_PREV_CHAR MappedKeys.Delete -> KeyCommand.DELETE_NEXT_WORD MappedKeys.Backspace -> KeyCommand.DELETE_PREV_WORD @@ -150,8 +186,10 @@ internal val defaultKeyMapping: KeyMapping = } event.isShiftPressed -> when (event.key) { - MappedKeys.MoveHome -> KeyCommand.SELECT_LINE_START - MappedKeys.MoveEnd -> KeyCommand.SELECT_LINE_END + MappedKeys.MoveHome, + MappedKeys.NumPadMoveHome -> KeyCommand.SELECT_LINE_START + MappedKeys.MoveEnd, + MappedKeys.NumPadMoveEnd -> KeyCommand.SELECT_LINE_END else -> null } event.isAltPressed -> diff --git a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/KeyMapping.desktop.kt b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/KeyMapping.desktop.kt index 0c584db1dbf7b..594162420764b 100644 --- a/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/KeyMapping.desktop.kt +++ b/compose/foundation/foundation/src/desktopMain/kotlin/androidx/compose/foundation/text/KeyMapping.desktop.kt @@ -19,6 +19,7 @@ package androidx.compose.foundation.text import java.awt.event.KeyEvent as AwtKeyEvent import androidx.compose.foundation.DesktopPlatform import androidx.compose.ui.input.key.Key +import java.awt.event.KeyEvent.KEY_LOCATION_NUMPAD internal actual val platformDefaultKeyMapping: KeyMapping get() = overriddenDefaultKeyMapping ?: _platformDefaultKeyMapping @@ -47,17 +48,26 @@ internal actual object MappedKeys { actual val Z: Key = Key(AwtKeyEvent.VK_Z) actual val Backslash: Key = Key(AwtKeyEvent.VK_BACK_SLASH) actual val DirectionLeft: Key = Key(AwtKeyEvent.VK_LEFT) + actual val NumPadDirectionLeft: Key = Key(AwtKeyEvent.VK_LEFT, KEY_LOCATION_NUMPAD) actual val DirectionRight: Key = Key(AwtKeyEvent.VK_RIGHT) + actual val NumPadDirectionRight: Key = Key(AwtKeyEvent.VK_RIGHT, KEY_LOCATION_NUMPAD) actual val DirectionUp: Key = Key(AwtKeyEvent.VK_UP) + actual val NumPadDirectionUp: Key = Key(AwtKeyEvent.VK_UP, KEY_LOCATION_NUMPAD) actual val DirectionDown: Key = Key(AwtKeyEvent.VK_DOWN) + actual val NumPadDirectionDown: Key = Key(AwtKeyEvent.VK_DOWN, KEY_LOCATION_NUMPAD) actual val DirectionCenter: Key = Key(AwtKeyEvent.VK_ACCEPT) actual val PageUp: Key = Key(AwtKeyEvent.VK_PAGE_UP) + actual val NumPadPageUp: Key = Key(AwtKeyEvent.VK_PAGE_UP, KEY_LOCATION_NUMPAD) actual val PageDown: Key = Key(AwtKeyEvent.VK_PAGE_DOWN) + actual val NumPadPageDown: Key = Key(AwtKeyEvent.VK_PAGE_DOWN, KEY_LOCATION_NUMPAD) actual val MoveHome: Key = Key(AwtKeyEvent.VK_HOME) + actual val NumPadMoveHome: Key = Key(AwtKeyEvent.VK_HOME, KEY_LOCATION_NUMPAD) actual val MoveEnd: Key = Key(AwtKeyEvent.VK_END) + actual val NumPadMoveEnd: Key = Key(AwtKeyEvent.VK_END, KEY_LOCATION_NUMPAD) actual val Insert: Key = Key(AwtKeyEvent.VK_INSERT) + actual val NumPadInsert: Key = Key(AwtKeyEvent.VK_INSERT, KEY_LOCATION_NUMPAD) actual val Enter: Key = Key(AwtKeyEvent.VK_ENTER) - actual val NumPadEnter = Key(AwtKeyEvent.VK_ENTER, AwtKeyEvent.KEY_LOCATION_NUMPAD) + actual val NumPadEnter = Key(AwtKeyEvent.VK_ENTER, KEY_LOCATION_NUMPAD) actual val Backspace: Key = Key(AwtKeyEvent.VK_BACK_SPACE) actual val Delete: Key = Key(AwtKeyEvent.VK_DELETE) actual val Paste: Key = Key(AwtKeyEvent.VK_PASTE) diff --git a/compose/foundation/foundation/src/nonJvmMain/kotlin/androidx/compose/foundation/text/KeyMapping.nonJvm.kt b/compose/foundation/foundation/src/nonJvmMain/kotlin/androidx/compose/foundation/text/KeyMapping.nonJvm.kt index 9b98a20b071b7..920e68ccec357 100644 --- a/compose/foundation/foundation/src/nonJvmMain/kotlin/androidx/compose/foundation/text/KeyMapping.nonJvm.kt +++ b/compose/foundation/foundation/src/nonJvmMain/kotlin/androidx/compose/foundation/text/KeyMapping.nonJvm.kt @@ -32,15 +32,24 @@ internal actual object MappedKeys { actual val Z: Key = Key(Key.Z.keyCode) actual val Backslash: Key = Key(Key.Backslash.keyCode) actual val DirectionLeft: Key = Key(Key.DirectionLeft.keyCode) + actual val NumPadDirectionLeft: Key = Key(Key.NumPadDirectionLeft.keyCode) actual val DirectionRight: Key = Key(Key.DirectionRight.keyCode) + actual val NumPadDirectionRight: Key = Key(Key.NumPadDirectionRight.keyCode) actual val DirectionUp: Key = Key(Key.DirectionUp.keyCode) + actual val NumPadDirectionUp: Key = Key(Key.NumPadDirectionUp.keyCode) actual val DirectionDown: Key = Key(Key.DirectionDown.keyCode) + actual val NumPadDirectionDown: Key = Key(Key.NumPadDirectionDown.keyCode) actual val DirectionCenter: Key = Key(Key.DirectionCenter.keyCode) actual val PageUp: Key = Key(Key.PageUp.keyCode) + actual val NumPadPageUp: Key = Key(Key.NumPadPageUp.keyCode) actual val PageDown: Key = Key(Key.PageDown.keyCode) + actual val NumPadPageDown: Key = Key(Key.NumPadPageDown.keyCode) actual val MoveHome: Key = Key(Key.MoveHome.keyCode) + actual val NumPadMoveHome: Key = Key(Key.NumPadMoveHome.keyCode) actual val MoveEnd: Key = Key(Key.MoveEnd.keyCode) + actual val NumPadMoveEnd: Key = Key(Key.NumPadMoveEnd.keyCode) actual val Insert: Key = Key(Key.Insert.keyCode) + actual val NumPadInsert: Key = Key(Key.NumPadInsert.keyCode) actual val Enter: Key = Key(Key.Enter.keyCode) actual val NumPadEnter: Key = Key(Key.NumPadEnter.keyCode) actual val Backspace: Key = Key(Key.Backspace.keyCode) diff --git a/compose/foundation/foundation/src/skikoMain/kotlin/androidx/compose/foundation/text/KeyMapping.skikoMain.kt b/compose/foundation/foundation/src/skikoMain/kotlin/androidx/compose/foundation/text/KeyMapping.skikoMain.kt index f7596285bf226..3cb0b37a09cb0 100644 --- a/compose/foundation/foundation/src/skikoMain/kotlin/androidx/compose/foundation/text/KeyMapping.skikoMain.kt +++ b/compose/foundation/foundation/src/skikoMain/kotlin/androidx/compose/foundation/text/KeyMapping.skikoMain.kt @@ -39,8 +39,10 @@ internal object defaultSkikoKeyMapping : KeyMapping { return when { event.isCtrlPressed && event.isShiftPressed -> { when (event.key) { - MappedKeys.MoveHome -> KeyCommand.SELECT_HOME - MappedKeys.MoveEnd -> KeyCommand.SELECT_END + MappedKeys.MoveHome, + MappedKeys.NumPadMoveHome -> KeyCommand.SELECT_HOME + MappedKeys.MoveEnd, + MappedKeys.NumPadMoveEnd -> KeyCommand.SELECT_END else -> null } } @@ -62,28 +64,40 @@ internal fun createMacosDefaultKeyMapping(): KeyMapping { event.isShiftPressed && event.isAltPressed -> when (event.key) { - MappedKeys.DirectionLeft -> KeyCommand.SELECT_LEFT_WORD - MappedKeys.DirectionRight -> KeyCommand.SELECT_RIGHT_WORD - MappedKeys.DirectionUp -> KeyCommand.SELECT_PREV_PARAGRAPH - MappedKeys.DirectionDown -> KeyCommand.SELECT_NEXT_PARAGRAPH + MappedKeys.DirectionLeft, MappedKeys.NumPadDirectionLeft -> + KeyCommand.SELECT_LEFT_WORD + MappedKeys.DirectionRight, MappedKeys.NumPadDirectionRight -> + KeyCommand.SELECT_RIGHT_WORD + MappedKeys.DirectionUp, MappedKeys.NumPadDirectionUp -> + KeyCommand.SELECT_PREV_PARAGRAPH + MappedKeys.DirectionDown, MappedKeys.NumPadDirectionDown -> + KeyCommand.SELECT_NEXT_PARAGRAPH else -> null } event.isShiftPressed && event.isMetaPressed -> when (event.key) { - MappedKeys.DirectionLeft -> KeyCommand.SELECT_LINE_LEFT - MappedKeys.DirectionRight -> KeyCommand.SELECT_LINE_RIGHT - MappedKeys.DirectionUp -> KeyCommand.SELECT_HOME - MappedKeys.DirectionDown -> KeyCommand.SELECT_END + MappedKeys.DirectionLeft, MappedKeys.NumPadDirectionLeft -> + KeyCommand.SELECT_LINE_LEFT + MappedKeys.DirectionRight, MappedKeys.NumPadDirectionRight -> + KeyCommand.SELECT_LINE_RIGHT + MappedKeys.DirectionUp, MappedKeys.NumPadDirectionUp -> + KeyCommand.SELECT_HOME + MappedKeys.DirectionDown, MappedKeys.NumPadDirectionDown -> + KeyCommand.SELECT_END else -> null } event.isMetaPressed -> when (event.key) { - MappedKeys.DirectionLeft -> KeyCommand.LINE_LEFT - MappedKeys.DirectionRight -> KeyCommand.LINE_RIGHT - MappedKeys.DirectionUp -> KeyCommand.HOME - MappedKeys.DirectionDown -> KeyCommand.END + MappedKeys.DirectionLeft, MappedKeys.NumPadDirectionLeft -> + KeyCommand.LINE_LEFT + MappedKeys.DirectionRight, MappedKeys.NumPadDirectionRight -> + KeyCommand.LINE_RIGHT + MappedKeys.DirectionUp, MappedKeys.NumPadDirectionUp -> + KeyCommand.HOME + MappedKeys.DirectionDown, MappedKeys.NumPadDirectionDown -> + KeyCommand.END MappedKeys.Backspace -> KeyCommand.DELETE_FROM_LINE_START else -> null } @@ -136,17 +150,23 @@ internal fun createMacosDefaultKeyMapping(): KeyMapping { event.isShiftPressed -> when (event.key) { - MappedKeys.MoveHome -> KeyCommand.SELECT_HOME - MappedKeys.MoveEnd -> KeyCommand.SELECT_END + MappedKeys.MoveHome, + MappedKeys.NumPadMoveHome -> KeyCommand.SELECT_HOME + MappedKeys.MoveEnd, + MappedKeys.NumPadMoveEnd -> KeyCommand.SELECT_END else -> null } event.isAltPressed -> when (event.key) { - MappedKeys.DirectionLeft -> KeyCommand.LEFT_WORD - MappedKeys.DirectionRight -> KeyCommand.RIGHT_WORD - MappedKeys.DirectionUp -> KeyCommand.PREV_PARAGRAPH - MappedKeys.DirectionDown -> KeyCommand.NEXT_PARAGRAPH + MappedKeys.DirectionLeft, MappedKeys.NumPadDirectionLeft -> + KeyCommand.LEFT_WORD + MappedKeys.DirectionRight, MappedKeys.NumPadDirectionRight -> + KeyCommand.RIGHT_WORD + MappedKeys.DirectionUp, MappedKeys.NumPadDirectionUp -> + KeyCommand.PREV_PARAGRAPH + MappedKeys.DirectionDown, MappedKeys.NumPadDirectionDown -> + KeyCommand.NEXT_PARAGRAPH MappedKeys.Delete -> KeyCommand.DELETE_NEXT_WORD MappedKeys.Backspace -> KeyCommand.DELETE_PREV_WORD else -> null diff --git a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Slider.kt b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Slider.kt index 9ce1ebb7bdb83..0ce4bd03c65ba 100644 --- a/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Slider.kt +++ b/compose/material/material/src/commonMain/kotlin/androidx/compose/material/Slider.kt @@ -303,20 +303,20 @@ private fun Modifier.slideOnKeyEvents( val actualSteps = if (steps > 0) steps + 1 else 100 val delta = rangeLength / actualSteps when (it.key) { - Key.DirectionUp -> { + Key.DirectionUp, Key.NumPadDirectionUp -> { onValueChangeState.value((value + delta).coerceIn(valueRange)) true } - Key.DirectionDown -> { + Key.DirectionDown, Key.NumPadDirectionDown -> { onValueChangeState.value((value - delta).coerceIn(valueRange)) true } - Key.DirectionRight -> { + Key.DirectionRight, Key.NumPadDirectionRight -> { val sign = if (isRtl) -1 else 1 onValueChangeState.value((value + sign * delta).coerceIn(valueRange)) true } - Key.DirectionLeft -> { + Key.DirectionLeft, Key.NumPadDirectionLeft -> { val sign = if (isRtl) -1 else 1 onValueChangeState.value((value - sign * delta).coerceIn(valueRange)) true diff --git a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt index b540ac06ef8c0..a5414af5aec52 100644 --- a/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt +++ b/compose/material3/material3/src/commonMain/kotlin/androidx/compose/material3/Slider.kt @@ -940,21 +940,21 @@ private fun Modifier.slideOnKeyEvents( if (isVertical) { val signForLeftRight = if (isRtl) -1 else 1 when (it.key) { - Key.DirectionUp -> { + Key.DirectionUp, Key.NumPadDirectionUp -> { onValueChangeState((value - sign * delta).coerceIn(valueRange)) return@onKeyEvent true } - Key.DirectionDown -> { + Key.DirectionDown, Key.NumPadDirectionDown -> { onValueChangeState((value + sign * delta).coerceIn(valueRange)) return@onKeyEvent true } - Key.DirectionRight -> { + Key.DirectionRight, Key.NumPadDirectionRight -> { onValueChangeState( (value + signForLeftRight * delta).coerceIn(valueRange) ) return@onKeyEvent true } - Key.DirectionLeft -> { + Key.DirectionLeft, Key.NumPadDirectionLeft -> { onValueChangeState( (value - signForLeftRight * delta).coerceIn(valueRange) ) diff --git a/compose/ui/ui/api/desktop/ui.api b/compose/ui/ui/api/desktop/ui.api index e5a92247d989b..ac466e500dcf6 100644 --- a/compose/ui/ui/api/desktop/ui.api +++ b/compose/ui/ui/api/desktop/ui.api @@ -1777,12 +1777,21 @@ public final class androidx/compose/ui/input/key/Key$Companion { public final fun getNumPad9-EK5gGoQ ()J public final fun getNumPadAdd-EK5gGoQ ()J public final fun getNumPadComma-EK5gGoQ ()J + public final fun getNumPadDirectionDown-EK5gGoQ ()J + public final fun getNumPadDirectionLeft-EK5gGoQ ()J + public final fun getNumPadDirectionRight-EK5gGoQ ()J + public final fun getNumPadDirectionUp-EK5gGoQ ()J public final fun getNumPadDivide-EK5gGoQ ()J public final fun getNumPadDot-EK5gGoQ ()J public final fun getNumPadEnter-EK5gGoQ ()J public final fun getNumPadEquals-EK5gGoQ ()J + public final fun getNumPadInsert-EK5gGoQ ()J public final fun getNumPadLeftParenthesis-EK5gGoQ ()J + public final fun getNumPadMoveEnd-EK5gGoQ ()J + public final fun getNumPadMoveHome-EK5gGoQ ()J public final fun getNumPadMultiply-EK5gGoQ ()J + public final fun getNumPadPageDown-EK5gGoQ ()J + public final fun getNumPadPageUp-EK5gGoQ ()J public final fun getNumPadRightParenthesis-EK5gGoQ ()J public final fun getNumPadSubtract-EK5gGoQ ()J public final fun getNumber-EK5gGoQ ()J diff --git a/compose/ui/ui/api/ui.klib.api b/compose/ui/ui/api/ui.klib.api index 1ed1220b56877..73edcdf94b574 100644 --- a/compose/ui/ui/api/ui.klib.api +++ b/compose/ui/ui/api/ui.klib.api @@ -2945,6 +2945,14 @@ final value class androidx.compose.ui.input.key/Key { // androidx.compose.ui.inp final fun (): androidx.compose.ui.input.key/Key // androidx.compose.ui.input.key/Key.Companion.NumPadAdd.|(){}[0] final val NumPadComma // androidx.compose.ui.input.key/Key.Companion.NumPadComma|{}NumPadComma[0] final fun (): androidx.compose.ui.input.key/Key // androidx.compose.ui.input.key/Key.Companion.NumPadComma.|(){}[0] + final val NumPadDirectionDown // androidx.compose.ui.input.key/Key.Companion.NumPadDirectionDown|{}NumPadDirectionDown[0] + final fun (): androidx.compose.ui.input.key/Key // androidx.compose.ui.input.key/Key.Companion.NumPadDirectionDown.|(){}[0] + final val NumPadDirectionLeft // androidx.compose.ui.input.key/Key.Companion.NumPadDirectionLeft|{}NumPadDirectionLeft[0] + final fun (): androidx.compose.ui.input.key/Key // androidx.compose.ui.input.key/Key.Companion.NumPadDirectionLeft.|(){}[0] + final val NumPadDirectionRight // androidx.compose.ui.input.key/Key.Companion.NumPadDirectionRight|{}NumPadDirectionRight[0] + final fun (): androidx.compose.ui.input.key/Key // androidx.compose.ui.input.key/Key.Companion.NumPadDirectionRight.|(){}[0] + final val NumPadDirectionUp // androidx.compose.ui.input.key/Key.Companion.NumPadDirectionUp|{}NumPadDirectionUp[0] + final fun (): androidx.compose.ui.input.key/Key // androidx.compose.ui.input.key/Key.Companion.NumPadDirectionUp.|(){}[0] final val NumPadDivide // androidx.compose.ui.input.key/Key.Companion.NumPadDivide|{}NumPadDivide[0] final fun (): androidx.compose.ui.input.key/Key // androidx.compose.ui.input.key/Key.Companion.NumPadDivide.|(){}[0] final val NumPadDot // androidx.compose.ui.input.key/Key.Companion.NumPadDot|{}NumPadDot[0] @@ -2953,10 +2961,20 @@ final value class androidx.compose.ui.input.key/Key { // androidx.compose.ui.inp final fun (): androidx.compose.ui.input.key/Key // androidx.compose.ui.input.key/Key.Companion.NumPadEnter.|(){}[0] final val NumPadEquals // androidx.compose.ui.input.key/Key.Companion.NumPadEquals|{}NumPadEquals[0] final fun (): androidx.compose.ui.input.key/Key // androidx.compose.ui.input.key/Key.Companion.NumPadEquals.|(){}[0] + final val NumPadInsert // androidx.compose.ui.input.key/Key.Companion.NumPadInsert|{}NumPadInsert[0] + final fun (): androidx.compose.ui.input.key/Key // androidx.compose.ui.input.key/Key.Companion.NumPadInsert.|(){}[0] final val NumPadLeftParenthesis // androidx.compose.ui.input.key/Key.Companion.NumPadLeftParenthesis|{}NumPadLeftParenthesis[0] final fun (): androidx.compose.ui.input.key/Key // androidx.compose.ui.input.key/Key.Companion.NumPadLeftParenthesis.|(){}[0] + final val NumPadMoveEnd // androidx.compose.ui.input.key/Key.Companion.NumPadMoveEnd|{}NumPadMoveEnd[0] + final fun (): androidx.compose.ui.input.key/Key // androidx.compose.ui.input.key/Key.Companion.NumPadMoveEnd.|(){}[0] + final val NumPadMoveHome // androidx.compose.ui.input.key/Key.Companion.NumPadMoveHome|{}NumPadMoveHome[0] + final fun (): androidx.compose.ui.input.key/Key // androidx.compose.ui.input.key/Key.Companion.NumPadMoveHome.|(){}[0] final val NumPadMultiply // androidx.compose.ui.input.key/Key.Companion.NumPadMultiply|{}NumPadMultiply[0] final fun (): androidx.compose.ui.input.key/Key // androidx.compose.ui.input.key/Key.Companion.NumPadMultiply.|(){}[0] + final val NumPadPageDown // androidx.compose.ui.input.key/Key.Companion.NumPadPageDown|{}NumPadPageDown[0] + final fun (): androidx.compose.ui.input.key/Key // androidx.compose.ui.input.key/Key.Companion.NumPadPageDown.|(){}[0] + final val NumPadPageUp // androidx.compose.ui.input.key/Key.Companion.NumPadPageUp|{}NumPadPageUp[0] + final fun (): androidx.compose.ui.input.key/Key // androidx.compose.ui.input.key/Key.Companion.NumPadPageUp.|(){}[0] final val NumPadRightParenthesis // androidx.compose.ui.input.key/Key.Companion.NumPadRightParenthesis|{}NumPadRightParenthesis[0] final fun (): androidx.compose.ui.input.key/Key // androidx.compose.ui.input.key/Key.Companion.NumPadRightParenthesis.|(){}[0] final val NumPadSubtract // androidx.compose.ui.input.key/Key.Companion.NumPadSubtract|{}NumPadSubtract[0] diff --git a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/key/Key.kt b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/key/Key.kt index 2668771c232a2..3c44932c11eed 100644 --- a/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/key/Key.kt +++ b/compose/ui/ui/src/commonMain/kotlin/androidx/compose/ui/input/key/Key.kt @@ -777,6 +777,33 @@ expect value class Key(val keyCode: Long) { /** Numeric keypad ')' key. */ val NumPadRightParenthesis: Key + /** Numeric keypad Up Arrow Key. */ + val NumPadDirectionUp: Key + + /** Numeric keypad Down Arrow Key. */ + val NumPadDirectionDown: Key + + /** Numeric keypad Left Arrow Key. */ + val NumPadDirectionLeft: Key + + /** Numeric keypad Right Arrow Key. */ + val NumPadDirectionRight: Key + + /** Numeric keypad Home Key. */ + val NumPadMoveHome: Key + + /** Numeric keypad End Key. */ + val NumPadMoveEnd: Key + + /** Numeric keypad Page Up Key. */ + val NumPadPageUp: Key + + /** Numeric keypad Page Down Key. */ + val NumPadPageDown: Key + + /** Numeric keypad Insert Key. */ + val NumPadInsert: Key + /** Play media key. */ val MediaPlay: Key diff --git a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/input/key/Key.desktop.kt b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/input/key/Key.desktop.kt index e8da31de684b6..e6d16a9f73818 100644 --- a/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/input/key/Key.desktop.kt +++ b/compose/ui/ui/src/desktopMain/kotlin/androidx/compose/ui/input/key/Key.desktop.kt @@ -419,6 +419,33 @@ actual value class Key(val keyCode: Long) { actual val MoveHome = Key(KeyEvent.VK_HOME) actual val MoveEnd = Key(KeyEvent.VK_END) + /** Numeric keypad Up Arrow Key. */ + actual val NumPadDirectionUp = Key(KeyEvent.VK_UP, KEY_LOCATION_NUMPAD) + + /** Numeric keypad Down Arrow Key. */ + actual val NumPadDirectionDown = Key(KeyEvent.VK_DOWN, KEY_LOCATION_NUMPAD) + + /** Numeric keypad Left Arrow Key. */ + actual val NumPadDirectionLeft = Key(KeyEvent.VK_LEFT, KEY_LOCATION_NUMPAD) + + /** Numeric keypad Right Arrow Key. */ + actual val NumPadDirectionRight = Key(KeyEvent.VK_RIGHT, KEY_LOCATION_NUMPAD) + + /** Numeric keypad Home Key. */ + actual val NumPadMoveHome: Key = Key(KeyEvent.VK_HOME, KEY_LOCATION_NUMPAD) + + /** Numeric keypad End Key. */ + actual val NumPadMoveEnd = Key(KeyEvent.VK_END, KEY_LOCATION_NUMPAD) + + /** Numeric keypad Page Up Key. */ + actual val NumPadPageUp = Key(KeyEvent.VK_PAGE_UP, KEY_LOCATION_NUMPAD) + + /** Numeric keypad Page Down Key. */ + actual val NumPadPageDown = Key(KeyEvent.VK_PAGE_DOWN, KEY_LOCATION_NUMPAD) + + /** Numeric keypad Insert Key. */ + actual val NumPadInsert = Key(KeyEvent.VK_INSERT, KEY_LOCATION_NUMPAD) + // Unsupported Keys. These keys will never be sent by the desktop. However we need unique // keycodes so that these constants can be used in a when statement without a warning. actual val SoftLeft = Key(-1000000001) diff --git a/compose/ui/ui/src/macosMain/kotlin/androidx/compose/ui/input/key/Key.macos.kt b/compose/ui/ui/src/macosMain/kotlin/androidx/compose/ui/input/key/Key.macos.kt index 6ce34cf8ab959..d098245b2774a 100644 --- a/compose/ui/ui/src/macosMain/kotlin/androidx/compose/ui/input/key/Key.macos.kt +++ b/compose/ui/ui/src/macosMain/kotlin/androidx/compose/ui/input/key/Key.macos.kt @@ -553,6 +553,15 @@ actual value class Key(val keyCode: Long) { actual val NumPadEquals = Key(-1000000195) actual val NumPadLeftParenthesis = Key(-1000000196) actual val NumPadRightParenthesis = Key(-1000000197) + actual val NumPadDirectionUp = Key(-1000000198) + actual val NumPadDirectionDown = Key(-1000000199) + actual val NumPadDirectionLeft = Key(-1000000200) + actual val NumPadDirectionRight = Key(-1000000201) + actual val NumPadMoveHome = Key(-1000000202) + actual val NumPadMoveEnd = Key(-1000000203) + actual val NumPadPageUp = Key(-1000000204) + actual val NumPadPageDown = Key(-1000000205) + actual val NumPadInsert = Key(-1000000206) } actual override fun toString() = "Key keyCode: $keyCode" diff --git a/compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/input/key/Key.uikit.kt b/compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/input/key/Key.uikit.kt index a342f7d9436db..2335ac413f5de 100644 --- a/compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/input/key/Key.uikit.kt +++ b/compose/ui/ui/src/uikitMain/kotlin/androidx/compose/ui/input/key/Key.uikit.kt @@ -555,6 +555,15 @@ actual value class Key(val keyCode: Long) { actual val NumPadEquals = Key(-1000000195) actual val NumPadLeftParenthesis = Key(-1000000196) actual val NumPadRightParenthesis = Key(-1000000197) + actual val NumPadDirectionUp = Key(-1000000198) + actual val NumPadDirectionDown = Key(-1000000199) + actual val NumPadDirectionLeft = Key(-1000000200) + actual val NumPadDirectionRight = Key(-1000000201) + actual val NumPadMoveHome = Key(-1000000202) + actual val NumPadMoveEnd = Key(-1000000203) + actual val NumPadPageUp = Key(-1000000204) + actual val NumPadPageDown = Key(-1000000205) + actual val NumPadInsert = Key(-1000000206) } actual override fun toString() = "Key keyCode: $keyCode" diff --git a/compose/ui/ui/src/webMain/kotlin/androidx/compose/ui/input/key/Key.web.kt b/compose/ui/ui/src/webMain/kotlin/androidx/compose/ui/input/key/Key.web.kt index dcb2a94a84d73..17e0df18d0cab 100644 --- a/compose/ui/ui/src/webMain/kotlin/androidx/compose/ui/input/key/Key.web.kt +++ b/compose/ui/ui/src/webMain/kotlin/androidx/compose/ui/input/key/Key.web.kt @@ -554,6 +554,15 @@ actual value class Key(val keyCode: Long) { actual val NumPadEquals = Key(-1000000195) actual val NumPadLeftParenthesis = Key(-1000000196) actual val NumPadRightParenthesis = Key(-1000000197) + actual val NumPadDirectionUp = Key(-1000000198) + actual val NumPadDirectionDown = Key(-1000000199) + actual val NumPadDirectionLeft = Key(-1000000200) + actual val NumPadDirectionRight = Key(-1000000201) + actual val NumPadMoveHome = Key(-1000000202) + actual val NumPadMoveEnd = Key(-1000000203) + actual val NumPadPageUp = Key(-1000000204) + actual val NumPadPageDown = Key(-1000000205) + actual val NumPadInsert = Key(-1000000206) } actual override fun toString() = "Key keyCode: $keyCode"