Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
S
skiko
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
liuqiang
skiko
Commits
b5864536
Unverified
Commit
b5864536
authored
Jan 11, 2021
by
Nikolay Igotti
Committed by
GitHub
Jan 11, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Loader and initializer tweaks. (#39)
parent
2e828022
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
35 additions
and
16 deletions
+35
-16
Library.kt
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/Library.kt
+9
-16
LibraryLoadException.kt
...vmMain/kotlin/org/jetbrains/skiko/LibraryLoadException.kt
+5
-0
Setup.kt
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/Setup.kt
+21
-0
No files found.
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/Library.kt
View file @
b5864536
...
@@ -5,7 +5,6 @@ import java.io.InputStreamReader
...
@@ -5,7 +5,6 @@ import java.io.InputStreamReader
import
java.io.File
import
java.io.File
import
java.nio.file.Files
import
java.nio.file.Files
import
java.nio.file.StandardCopyOption
import
java.nio.file.StandardCopyOption
import
javax.swing.UIManager
object
Library
{
object
Library
{
private
var
loaded
=
false
private
var
loaded
=
false
...
@@ -38,7 +37,11 @@ object Library {
...
@@ -38,7 +37,11 @@ object Library {
val
name
=
"skiko-$hostId"
val
name
=
"skiko-$hostId"
val
platformName
=
System
.
mapLibraryName
(
name
)
val
platformName
=
System
.
mapLibraryName
(
name
)
val
hash
=
Library
::
class
.
java
.
getResourceAsStream
(
"$resourcePath$platformName.sha256"
).
use
{
val
hashResourceStream
=
Library
::
class
.
java
.
getResourceAsStream
(
"$resourcePath$platformName.sha256"
)
?:
throw
LibraryLoadException
(
"Cannot find $platformName.sha256, proper native dependency missing."
)
val
hash
=
hashResourceStream
.
use
{
BufferedReader
(
InputStreamReader
(
it
)).
lines
().
toArray
()[
0
]
as
String
BufferedReader
(
InputStreamReader
(
it
)).
lines
().
toArray
()[
0
]
as
String
}
}
val
cacheDir
=
File
(
"$cacheRoot/$hash"
)
val
cacheDir
=
File
(
"$cacheRoot/$hash"
)
...
@@ -49,7 +52,10 @@ object Library {
...
@@ -49,7 +52,10 @@ object Library {
loadOrGet
(
cacheDir
,
resourcePath
,
"icudtl.dat"
,
false
)
loadOrGet
(
cacheDir
,
resourcePath
,
"icudtl.dat"
,
false
)
}
}
miscSystemInit
()
Setup
.
init
(
System
.
getProperty
(
"skiko.rendering.laf.global"
)
==
"true"
,
System
.
getProperty
(
"skiko.rendering.noerasebackground"
)
!=
"false"
)
try
{
try
{
// Init code executed after library was loaded.
// Init code executed after library was loaded.
...
@@ -60,18 +66,5 @@ object Library {
...
@@ -60,18 +66,5 @@ object Library {
loaded
=
true
loaded
=
true
}
}
// This function doesn't actually belong to this file.
private
fun
miscSystemInit
()
{
// we have to set this property to avoid render flickering.
System
.
setProperty
(
"sun.awt.noerasebackground"
,
"true"
)
System
.
setProperty
(
"skija.staticLoad"
,
"false"
)
// setup menu look and feel
try
{
UIManager
.
setLookAndFeel
(
UIManager
.
getSystemLookAndFeelClassName
())
System
.
setProperty
(
"apple.laf.useScreenMenuBar"
,
"true"
)
}
catch
(
e
:
UnsupportedOperationException
)
{
// Not all platforms allow this.
}
}
}
}
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/LibraryLoadException.kt
0 → 100644
View file @
b5864536
package
org.jetbrains.skiko
import
java.lang.RuntimeException
class
LibraryLoadException
(
message
:
String
)
:
RuntimeException
(
message
)
\ No newline at end of file
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/Setup.kt
0 → 100644
View file @
b5864536
package
org.jetbrains.skiko
import
javax.swing.UIManager
object
Setup
{
fun
init
(
globalLAF
:
Boolean
=
false
,
noEraseBackground
:
Boolean
=
true
)
{
if
(
noEraseBackground
)
{
// we have to set this property to avoid render flickering.
System
.
setProperty
(
"sun.awt.noerasebackground"
,
"true"
)
}
try
{
if
(
globalLAF
)
{
// Setup menu look and feel.
UIManager
.
setLookAndFeel
(
UIManager
.
getSystemLookAndFeelClassName
())
System
.
setProperty
(
"apple.laf.useScreenMenuBar"
,
"true"
)
}
}
catch
(
e
:
UnsupportedOperationException
)
{
// Not all platforms allow this.
}
}
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment