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
09245b2d
Unverified
Commit
09245b2d
authored
Nov 22, 2023
by
Marcin Wisniowski
Committed by
GitHub
Nov 22, 2023
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use xdg-open to open URLs on Linux if AWT does not support it (#799)
parent
fd74c1d6
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
14 additions
and
1 deletion
+14
-1
Actuals.awt.kt
skiko/src/awtMain/kotlin/org/jetbrains/skiko/Actuals.awt.kt
+14
-1
No files found.
skiko/src/awtMain/kotlin/org/jetbrains/skiko/Actuals.awt.kt
View file @
09245b2d
...
@@ -8,7 +8,9 @@ import java.awt.datatransfer.DataFlavor
...
@@ -8,7 +8,9 @@ import java.awt.datatransfer.DataFlavor
import
java.awt.datatransfer.StringSelection
import
java.awt.datatransfer.StringSelection
import
java.awt.datatransfer.UnsupportedFlavorException
import
java.awt.datatransfer.UnsupportedFlavorException
import
java.io.IOException
import
java.io.IOException
import
java.net.MalformedURLException
import
java.net.URI
import
java.net.URI
import
java.net.URL
import
javax.swing.UIManager
import
javax.swing.UIManager
actual
fun
setSystemLookAndFeel
()
=
UIManager
.
setLookAndFeel
(
UIManager
.
getSystemLookAndFeelClassName
())
actual
fun
setSystemLookAndFeel
()
=
UIManager
.
setLookAndFeel
(
UIManager
.
getSystemLookAndFeelClassName
())
...
@@ -41,7 +43,18 @@ internal actual fun makeDefaultRenderFactory(): RenderFactory =
...
@@ -41,7 +43,18 @@ internal actual fun makeDefaultRenderFactory(): RenderFactory =
}
}
internal
actual
fun
URIHandler_openUri
(
uri
:
String
)
{
internal
actual
fun
URIHandler_openUri
(
uri
:
String
)
{
Desktop
.
getDesktop
().
browse
(
URI
(
uri
))
val
desktop
=
Desktop
.
getDesktop
()
if
(
desktop
.
isSupported
(
Desktop
.
Action
.
BROWSE
))
{
desktop
.
browse
(
URI
(
uri
))
}
else
when
(
hostOs
)
{
OS
.
Linux
->
{
URI
(
uri
)
// Validate URI for exception behavior consistent with the Desktop.browse() case (throwing URISyntaxException)
Runtime
.
getRuntime
().
exec
(
arrayOf
(
"xdg-open"
,
URL
(
uri
).
toString
()))
}
OS
.
Android
,
OS
.
Windows
,
OS
.
MacOS
,
OS
.
Ios
,
OS
.
JS
,
OS
.
Unknown
->
{
throw
UnsupportedOperationException
(
"AWT does not support the BROWSE action on this platform"
)
}
}
}
}
private
val
systemClipboard
by
lazy
{
private
val
systemClipboard
by
lazy
{
...
...
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