From fc84306bcc741b484ea7a0446f1fe2eb01ad9757 Mon Sep 17 00:00:00 2001 From: fscarponi Date: Fri, 13 Oct 2023 09:36:50 +0200 Subject: [PATCH 1/2] IconButton border hotfix --- core/src/main/kotlin/org/jetbrains/jewel/IconButton.kt | 6 ++---- .../kotlin/org/jetbrains/jewel/styling/IconButtonMetrics.kt | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/core/src/main/kotlin/org/jetbrains/jewel/IconButton.kt b/core/src/main/kotlin/org/jetbrains/jewel/IconButton.kt index 3b6d9a428..61b4e4a2f 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/IconButton.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/IconButton.kt @@ -20,7 +20,6 @@ import androidx.compose.runtime.remember import androidx.compose.runtime.setValue import androidx.compose.ui.Alignment import androidx.compose.ui.Modifier -import androidx.compose.ui.draw.clip import androidx.compose.ui.semantics.Role import org.jetbrains.jewel.styling.IconButtonStyle @@ -70,10 +69,9 @@ fun IconButton( interactionSource = interactionSource, indication = NoIndication, ) - .clip(shape) .padding(style.metrics.padding) - .background(background) - .border(style.metrics.borderWidth, border), + .background(background, shape) + .border(style.metrics.borderWidth, border, shape), contentAlignment = Alignment.Center, content = { content(buttonState) diff --git a/core/src/main/kotlin/org/jetbrains/jewel/styling/IconButtonMetrics.kt b/core/src/main/kotlin/org/jetbrains/jewel/styling/IconButtonMetrics.kt index 04541a1b1..c34923395 100644 --- a/core/src/main/kotlin/org/jetbrains/jewel/styling/IconButtonMetrics.kt +++ b/core/src/main/kotlin/org/jetbrains/jewel/styling/IconButtonMetrics.kt @@ -49,9 +49,9 @@ interface IconButtonColors { fun borderFor(state: ButtonState) = rememberUpdatedState( when { !state.isEnabled -> borderDisabled + state.isFocused -> borderFocused state.isPressed -> borderPressed state.isHovered -> borderHovered - state.isFocused -> borderFocused else -> border }, ) From cc26ad9c64d6e6faf3c7fd5d2b15a20ad5b91791 Mon Sep 17 00:00:00 2001 From: Lamberto Basti Date: Fri, 13 Oct 2023 10:11:00 +0200 Subject: [PATCH 2/2] Improve error handling for missing 'supported.ij.version' (#175) * Improve error handling for missing 'supported.ij.version' Updated 'supported.ij.version' property handling in IdeaConfiguration.kt to better manage cases when the property is not set. Instead of throwing an error, it now sets a default value and logs a warning message once, advising the user to provide the missing property. --------- Co-authored-by: Sebastiano Poggi --- buildSrc/src/main/kotlin/IdeaConfiguration.kt | 37 ++++++++++++------- 1 file changed, 24 insertions(+), 13 deletions(-) diff --git a/buildSrc/src/main/kotlin/IdeaConfiguration.kt b/buildSrc/src/main/kotlin/IdeaConfiguration.kt index d632be9fa..ecdb2e735 100644 --- a/buildSrc/src/main/kotlin/IdeaConfiguration.kt +++ b/buildSrc/src/main/kotlin/IdeaConfiguration.kt @@ -1,3 +1,4 @@ +import java.util.concurrent.atomic.AtomicBoolean import org.gradle.api.Project enum class SupportedIJVersion { @@ -5,22 +6,32 @@ enum class SupportedIJVersion { IJ_233 } +private var warned = AtomicBoolean(false) + fun Project.supportedIJVersion(): SupportedIJVersion { - val prop = localProperty("supported.ij.version") - ?: rootProject.property("supported.ij.version") - ?: error( - "'supported.ij.version' gradle property is missing. " + - "Please, provide it using local.properties file or -Psupported.ij.version argument in CLI" - ) + val prop = kotlin.runCatching { + localProperty("supported.ij.version") + ?: rootProject.property("supported.ij.version")?.toString() + }.getOrNull() + + if (prop == null) { + if (!warned.getAndSet(true)) { + logger.warn( + """ + No 'supported.ij.version' property provided. Falling back to IJ 233. + It is recommended to provide it using local.properties file or -Psupported.ij.version to avoid unexpected behavior. + """.trimIndent() + ) + } + return SupportedIJVersion.IJ_233 + } return when (prop) { "232" -> SupportedIJVersion.IJ_232 "233" -> SupportedIJVersion.IJ_233 - else -> { - error( - "Invalid 'supported.ij.version' with value '$prop' is provided. " + - "It should be in set of these values: ('232', '233')" - ) - } + else -> error( + "Invalid 'supported.ij.version' with value '$prop' is provided. " + + "It should be in set of these values: ('232', '233')" + ) } -} \ No newline at end of file +}