Updated Compose Multiplatform to 1.5.0-rc01
This commit is contained in:
parent
e2cf95712a
commit
2cc4ca18b5
11 changed files with 29 additions and 39 deletions
|
@ -9,7 +9,7 @@ plugins {
|
|||
kotlin("jvm") version "1.7.10"
|
||||
kotlin("kapt") version "1.7.10"
|
||||
kotlin("plugin.serialization") version "1.7.10"
|
||||
id("org.jetbrains.compose") version "1.4.1"
|
||||
id("org.jetbrains.compose") version "1.5.0-rc01"
|
||||
}
|
||||
|
||||
// Remember to update Constants.APP_VERSION when changing this version
|
||||
|
|
|
@ -91,25 +91,6 @@ fun Modifier.onDoubleClick(
|
|||
}
|
||||
}
|
||||
|
||||
// TODO Try to restore hover that was shown with clickable modifier
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
fun Modifier.fastClickable(key: Any = Unit, key2: Any = Unit, onClick: () -> Unit) =
|
||||
this.handOnHover()
|
||||
.hoverBackground()
|
||||
.pointerInput(key, key2) {
|
||||
while (true) {
|
||||
val lastMouseEvent = awaitPointerEventScope { awaitFirstDownEvent() }
|
||||
val mouseEvent = lastMouseEvent.awtEventOrNull
|
||||
|
||||
if (mouseEvent != null) {
|
||||
if (lastMouseEvent.button.isPrimary) {
|
||||
onClick()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@OptIn(ExperimentalComposeUiApi::class)
|
||||
@Composable
|
||||
fun Modifier.onMiddleMouseButtonClick(key: Any = Unit, key2: Any = Unit, onClick: () -> Unit) =
|
||||
|
|
|
@ -4,6 +4,7 @@ package com.jetpackduba.gitnuro.ui
|
|||
|
||||
import androidx.compose.foundation.Image
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.clickable
|
||||
import androidx.compose.foundation.focusable
|
||||
import androidx.compose.foundation.layout.*
|
||||
import androidx.compose.foundation.text.selection.DisableSelection
|
||||
|
@ -96,7 +97,7 @@ fun Blame(
|
|||
.width(200.dp)
|
||||
.fillMaxHeight()
|
||||
.background(MaterialTheme.colors.secondarySurface)
|
||||
.fastClickable { if (commit != null) onSelectCommit(commit) },
|
||||
.clickable { if (commit != null) onSelectCommit(commit) },
|
||||
verticalArrangement = Arrangement.Center,
|
||||
) {
|
||||
Text(
|
||||
|
|
|
@ -33,6 +33,7 @@ import androidx.compose.ui.res.painterResource
|
|||
import androidx.compose.ui.unit.*
|
||||
import androidx.compose.ui.window.Popup
|
||||
import androidx.compose.ui.window.PopupPositionProvider
|
||||
import androidx.compose.ui.window.PopupProperties
|
||||
import androidx.compose.ui.window.rememberPopupPositionProviderAtPosition
|
||||
import com.jetpackduba.gitnuro.AppIcons
|
||||
import com.jetpackduba.gitnuro.extensions.awaitFirstDownEvent
|
||||
|
@ -135,7 +136,9 @@ private fun Modifier.dropdownMenu(items: () -> List<ContextMenuElement>): Modifi
|
|||
@Composable
|
||||
fun showPopup(x: Int, y: Int, contextMenuElements: List<ContextMenuElement>, onDismissRequest: () -> Unit) {
|
||||
Popup(
|
||||
focusable = true,
|
||||
properties = PopupProperties(
|
||||
focusable = true,
|
||||
),
|
||||
popupPositionProvider = object : PopupPositionProvider {
|
||||
override fun calculatePosition(
|
||||
anchorBounds: IntRect,
|
||||
|
@ -331,7 +334,9 @@ class AppContextMenuRepresentation : ContextMenuRepresentation {
|
|||
var inputModeManager: InputModeManager? by mutableStateOf(null)
|
||||
|
||||
Popup(
|
||||
focusable = true,
|
||||
properties = PopupProperties(
|
||||
focusable = true,
|
||||
),
|
||||
onDismissRequest = { state.status = ContextMenuState.Status.Closed },
|
||||
popupPositionProvider = rememberPopupPositionProviderAtPosition(
|
||||
positionPx = status.rect.center
|
||||
|
|
|
@ -26,6 +26,7 @@ import androidx.compose.ui.input.key.type
|
|||
import androidx.compose.ui.unit.*
|
||||
import androidx.compose.ui.window.Popup
|
||||
import androidx.compose.ui.window.PopupPositionProvider
|
||||
import androidx.compose.ui.window.PopupProperties
|
||||
import com.jetpackduba.gitnuro.keybindings.KeybindingOption
|
||||
import com.jetpackduba.gitnuro.keybindings.matchesBinding
|
||||
import com.jetpackduba.gitnuro.theme.dialogOverlay
|
||||
|
@ -40,7 +41,9 @@ fun MaterialDialog(
|
|||
content: @Composable () -> Unit
|
||||
) {
|
||||
Popup(
|
||||
focusable = true,
|
||||
properties = PopupProperties(
|
||||
focusable = true,
|
||||
),
|
||||
popupPositionProvider = object : PopupPositionProvider {
|
||||
override fun calculatePosition(
|
||||
anchorBounds: IntRect,
|
||||
|
|
|
@ -111,9 +111,9 @@ fun NewBranchDialog(
|
|||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
branchFieldFocusRequester.requestFocus()
|
||||
LaunchedEffect(Unit) {
|
||||
branchFieldFocusRequester.requestFocus()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -111,9 +111,9 @@ fun NewTagDialog(
|
|||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
fieldFocusRequester.requestFocus()
|
||||
LaunchedEffect(Unit) {
|
||||
fieldFocusRequester.requestFocus()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -168,9 +168,9 @@ fun SignOffDialog(
|
|||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(state) {
|
||||
signOffFieldFocusRequester.requestFocus()
|
||||
LaunchedEffect(state) {
|
||||
signOffFieldFocusRequester.requestFocus()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -111,9 +111,9 @@ fun StashWithMessageDialog(
|
|||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LaunchedEffect(Unit) {
|
||||
textFieldFocusRequester.requestFocus()
|
||||
LaunchedEffect(Unit) {
|
||||
textFieldFocusRequester.requestFocus()
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1149,7 +1149,7 @@ fun DiffLineText(line: Line, diffEntryType: DiffEntryType, onActionTriggered: ()
|
|||
contentDescription = null,
|
||||
tint = Color.White,
|
||||
modifier = Modifier
|
||||
.fastClickable(line) { onActionTriggered() }
|
||||
.clickable { onActionTriggered() }
|
||||
.size(16.dp)
|
||||
.clip(RoundedCornerShape(2.dp))
|
||||
.background(color),
|
||||
|
|
|
@ -457,7 +457,7 @@ fun MessagesList(
|
|||
modifier = Modifier.height(LINE_HEIGHT.dp)
|
||||
.clipToBounds()
|
||||
.fillMaxWidth()
|
||||
.fastClickable { logViewModel.selectUncommitedChanges() }
|
||||
.clickable { logViewModel.selectUncommitedChanges() }
|
||||
) {
|
||||
UncommitedChangesGraphNode(
|
||||
hasPreviousCommits = commitList.isNotEmpty(),
|
||||
|
@ -760,7 +760,7 @@ fun CommitLine(
|
|||
) {
|
||||
Box(
|
||||
modifier = Modifier
|
||||
.fastClickable(graphNode, logViewModel) { onRevCommitSelected() }
|
||||
.clickable { onRevCommitSelected() }
|
||||
) {
|
||||
val nodeColor = colors[graphNode.lane.position % colors.size]
|
||||
|
||||
|
|
Loading…
Reference in a new issue