-
Notifications
You must be signed in to change notification settings - Fork 126
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix library load on SystemTheme (#868)
- Loading branch information
1 parent
265da83
commit 2a8e25d
Showing
4 changed files
with
13 additions
and
11 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 10 additions & 8 deletions
18
skiko/src/awtMain/kotlin/org/jetbrains/skiko/SystemTheme.awt.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,16 @@ | ||
package org.jetbrains.skiko | ||
|
||
actual val currentSystemTheme: SystemTheme | ||
get() { | ||
get() = when (SystemThemeHelper.getCurrentSystemTheme()) { | ||
0 -> SystemTheme.LIGHT | ||
1 -> SystemTheme.DARK | ||
else -> SystemTheme.UNKNOWN | ||
} | ||
|
||
private object SystemThemeHelper { | ||
init { | ||
Library.load() | ||
return when (getCurrentSystemTheme()) { | ||
0 -> SystemTheme.LIGHT | ||
1 -> SystemTheme.DARK | ||
else -> SystemTheme.UNKNOWN | ||
} | ||
} | ||
|
||
// Common | ||
private external fun getCurrentSystemTheme(): Int | ||
external fun getCurrentSystemTheme(): Int | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters