Rename extension.

This commit is contained in:
Benoit Marty 2025-08-05 21:07:10 +02:00 committed by Benoit Marty
parent 864c27ace5
commit be82c6e257
15 changed files with 33 additions and 33 deletions

View file

@ -19,12 +19,12 @@ import androidx.compose.ui.input.key.type
* Modifier to handle Shift + F10 key events.
* This is typically used to trigger context menus in desktop applications.
*
* @param onShiftF10Press The callback to invoke when Shift + F10 is pressed.
* @param action The callback to invoke when Shift + F10 is pressed.
*/
fun Modifier.onShiftF10(
onShiftF10Press: (() -> Unit)?,
fun Modifier.onKeyboardContextMenuAction(
action: (() -> Unit)?,
): Modifier = then(
if (onShiftF10Press == null) {
if (action == null) {
Modifier
} else {
Modifier.onKeyEvent { keyEvent ->
@ -32,7 +32,7 @@ fun Modifier.onShiftF10(
if (keyEvent.type == KeyEventType.KeyUp &&
keyEvent.isShiftPressed &&
keyEvent.key == Key.F10) {
onShiftF10Press()
action()
true
} else {
false