Skip to content

Commit

Permalink
Fix keyboard shortcuts not working on native macOS (#1701)
Browse files Browse the repository at this point in the history
Keyboard shortcuts like copy/paste (COMMAND + C) are not working on
native macOS. This PR fixes the issue.

## Testing

Tested using mpp demo sample on macOS arm64
  • Loading branch information
Thomas-Vos authored Dec 3, 2024
1 parent 1fe8ae5 commit 759bd7b
Showing 1 changed file with 5 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,17 @@ package androidx.compose.foundation.text

import androidx.compose.ui.input.key.KeyEvent
import androidx.compose.ui.input.key.KeyEventType
import androidx.compose.ui.input.key.isCtrlPressed
import androidx.compose.ui.input.key.isMetaPressed
import androidx.compose.ui.input.key.type
import androidx.compose.ui.input.key.utf16CodePoint

actual val KeyEvent.isTypedEvent: Boolean
get() = type == KeyEventType.KeyDown &&
!isISOControl(utf16CodePoint) &&
!isAppKitReserved(utf16CodePoint)
!isAppKitReserved(utf16CodePoint) &&
!isMetaPressed &&
!isCtrlPressed

private fun isISOControl(codePoint: Int): Boolean =
codePoint in 0x00..0x1F ||
Expand Down

0 comments on commit 759bd7b

Please sign in to comment.