Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CfW: implement actual fun isCopyKeyEvent #1101

Merged
merged 1 commit into from
Feb 14, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,19 +17,24 @@
package androidx.compose.foundation.text.selection

import androidx.compose.ui.Modifier
import androidx.compose.ui.input.key.Key
import androidx.compose.ui.input.key.KeyEvent
import androidx.compose.ui.input.key.isCtrlPressed
import androidx.compose.ui.input.key.isMetaPressed
import androidx.compose.ui.input.key.key
import org.jetbrains.skiko.OS
import org.jetbrains.skiko.hostOs

// this doesn't sounds very sustainable
// it would end up being a function for any conceptual keyevent (selectall, cut, copy, paste)
// TODO(b/1564937)
internal actual fun isCopyKeyEvent(keyEvent: KeyEvent): Boolean =
TODO("implement native isCopyKeyEvent")
/*
keyEvent.key == Key.C && when (DesktopPlatform.Current) {
DesktopPlatform.MacOS -> keyEvent.isMetaPressed
internal actual fun isCopyKeyEvent(keyEvent: KeyEvent): Boolean {
val isCtrlOrCmdPressed = when (hostOs) {
OS.MacOS -> keyEvent.isMetaPressed
else -> keyEvent.isCtrlPressed
} || keyEvent.key == Key.Copy
*/
}
return isCtrlOrCmdPressed && keyEvent.key == Key.C
}

/**
* Magnification is not supported on desktop.
Expand Down
Loading