Skip to content

Commit bf2047a

Browse files
committed
fix(desktop, windows): drag and drop breaks when changing theme
1 parent b982aac commit bf2047a

File tree

8 files changed

+23
-21
lines changed

8 files changed

+23
-21
lines changed

application/src/androidMain/kotlin/com/neoutils/neoregex/Main.android.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,13 +42,13 @@ class MainActivity : ComponentActivity() {
4242
private fun setupSystemBars() {
4343

4444
val style = when (colorTheme) {
45-
ColorTheme.DARK -> {
45+
ColorTheme.DARK, ColorTheme.DARK_SYSTEM -> {
4646
SystemBarStyle.dark(
4747
Color.BLACK,
4848
)
4949
}
5050

51-
ColorTheme.LIGHT -> {
51+
ColorTheme.LIGHT, ColorTheme.LIGHT_SYSTEM -> {
5252
SystemBarStyle.light(
5353
Color.WHITE,
5454
Color.BLACK,

core/common/src/androidMain/kotlin/com/neoutils/neoregex/core/common/util/ColorTheme.android.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,19 +28,19 @@ import androidx.compose.runtime.Composable
2828
actual fun rememberColorTheme(): ColorTheme {
2929

3030
return if (isSystemInDarkTheme()) {
31-
ColorTheme.DARK
31+
ColorTheme.DARK_SYSTEM
3232
} else {
33-
ColorTheme.LIGHT
33+
ColorTheme.LIGHT_SYSTEM
3434
}
3535
}
3636

3737
val Context.colorTheme
3838
get() = when (resources.configuration.uiMode and UI_MODE_NIGHT_MASK) {
3939
UI_MODE_NIGHT_YES -> {
40-
ColorTheme.DARK
40+
ColorTheme.DARK_SYSTEM
4141
}
4242

4343
else -> {
44-
ColorTheme.LIGHT
44+
ColorTheme.LIGHT_SYSTEM
4545
}
4646
}

core/common/src/commonMain/kotlin/com/neoutils/neoregex/core/common/util/ColorTheme.kt

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@ import androidx.compose.runtime.Composable
2222

2323
enum class ColorTheme {
2424
LIGHT,
25-
DARK;
25+
DARK,
26+
LIGHT_SYSTEM,
27+
DARK_SYSTEM;
2628

2729
val isLight: Boolean
28-
get() = this == LIGHT
30+
get() = this == LIGHT || this == LIGHT_SYSTEM
2931

3032
val isDark: Boolean
31-
get() = this == DARK
33+
get() = this == DARK || this == DARK_SYSTEM
3234
}
3335

3436
@Composable

core/common/src/desktopMain/kotlin/com/neoutils/neoregex/core/common/util/ColorTheme.desktop.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,9 +37,9 @@ actual fun rememberColorTheme(): ColorTheme {
3737
}
3838

3939
else -> when (currentSystemTheme) {
40-
SystemTheme.LIGHT -> ColorTheme.LIGHT
41-
SystemTheme.DARK -> ColorTheme.DARK
42-
SystemTheme.UNKNOWN -> ColorTheme.LIGHT
40+
SystemTheme.LIGHT -> ColorTheme.LIGHT_SYSTEM
41+
SystemTheme.DARK -> ColorTheme.DARK_SYSTEM
42+
SystemTheme.UNKNOWN -> ColorTheme.LIGHT_SYSTEM
4343
}
4444
}
4545
}

core/common/src/desktopMain/kotlin/com/neoutils/neoregex/core/common/util/XDGDesktopPortal.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,9 +45,9 @@ class XDGDesktopPortal(
4545
)
4646

4747
return when (theme.value.value) {
48-
Theme.LIGHT.value -> ColorTheme.LIGHT
49-
Theme.DARK.value -> ColorTheme.DARK
50-
else -> ColorTheme.LIGHT
48+
Theme.LIGHT.value -> ColorTheme.LIGHT_SYSTEM
49+
Theme.DARK.value -> ColorTheme.DARK_SYSTEM
50+
else -> ColorTheme.LIGHT_SYSTEM
5151
}
5252
}
5353

core/common/src/webMain/kotlin/com/neoutils/neoregex/core/common/util/ColorTheme.web.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,8 +26,8 @@ import org.jetbrains.skiko.currentSystemTheme
2626
actual fun rememberColorTheme(): ColorTheme {
2727

2828
return when (currentSystemTheme) {
29-
SystemTheme.LIGHT -> ColorTheme.LIGHT
30-
SystemTheme.DARK -> ColorTheme.DARK
31-
SystemTheme.UNKNOWN -> ColorTheme.DARK
29+
SystemTheme.LIGHT -> ColorTheme.LIGHT_SYSTEM
30+
SystemTheme.DARK -> ColorTheme.DARK_SYSTEM
31+
SystemTheme.UNKNOWN -> ColorTheme.DARK_SYSTEM
3232
}
3333
}

core/design-system/src/commonMain/kotlin/com/neoutils/neoregex/core/designsystem/theme/Theme.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -73,8 +73,8 @@ fun NeoTheme(
7373
) {
7474
NeoBaseTheme(
7575
colorScheme = when (colorTheme) {
76-
ColorTheme.LIGHT -> LightColors
77-
ColorTheme.DARK -> DarkColors
76+
ColorTheme.LIGHT, ColorTheme.LIGHT_SYSTEM -> LightColors
77+
ColorTheme.DARK, ColorTheme.DARK_SYSTEM -> DarkColors
7878
},
7979
fontSizes = FontSizes(),
8080
dimensions = Dimensions(),

core/shared-ui/src/desktopMain/kotlin/com/neoutils/neoregex/core/sharedui/component/DefaultHeader.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ fun FrameWindowScope.NeoHeader(
9494
customTitleBar?.height = it.height.toFloat()
9595
}.run {
9696
customTitleBar?.let {
97-
pointerInput(Unit) {
97+
pointerInput(colorTheme) {
9898

9999
var inUserControl = false
100100

0 commit comments

Comments
 (0)