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