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
fda59e1f
Unverified
Commit
fda59e1f
authored
Jun 18, 2021
by
Pavel
Committed by
GitHub
Jun 18, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Allow request emoji and symbols popup on macOS (#123)
parent
23077f6c
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
49 additions
and
5 deletions
+49
-5
App.kt
...kijaInjectSample/src/main/kotlin/SkijaInjectSample/App.kt
+19
-5
PlatformOperations.kt
.../jvmMain/kotlin/org/jetbrains/skiko/PlatformOperations.kt
+12
-0
SkiaWindow.kt
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/SkiaWindow.kt
+4
-0
InputMethod.mm
skiko/src/jvmMain/objectiveC/macos/InputMethod.mm
+14
-0
No files found.
samples/SkijaInjectSample/src/main/kotlin/SkijaInjectSample/App.kt
View file @
fda59e1f
...
@@ -36,8 +36,8 @@ fun createWindow(title: String, exitOnClose: Boolean) = runBlocking(Dispatchers.
...
@@ -36,8 +36,8 @@ fun createWindow(title: String, exitOnClose: Boolean) = runBlocking(Dispatchers.
// Create menu.
// Create menu.
val
menuBar
=
JMenuBar
()
val
menuBar
=
JMenuBar
()
val
m
enu
=
JMenu
(
"File"
)
val
fileM
enu
=
JMenu
(
"File"
)
menuBar
.
add
(
m
enu
)
menuBar
.
add
(
fileM
enu
)
val
miFullscreenState
=
JMenuItem
(
"Is fullscreen mode"
)
val
miFullscreenState
=
JMenuItem
(
"Is fullscreen mode"
)
val
ctrlI
=
KeyStroke
.
getKeyStroke
(
KeyEvent
.
VK_I
,
Toolkit
.
getDefaultToolkit
().
getMenuShortcutKeyMaskEx
())
val
ctrlI
=
KeyStroke
.
getKeyStroke
(
KeyEvent
.
VK_I
,
Toolkit
.
getDefaultToolkit
().
getMenuShortcutKeyMaskEx
())
...
@@ -73,9 +73,23 @@ fun createWindow(title: String, exitOnClose: Boolean) = runBlocking(Dispatchers.
...
@@ -73,9 +73,23 @@ fun createWindow(title: String, exitOnClose: Boolean) = runBlocking(Dispatchers.
}
}
})
})
menu
.
add
(
miToggleFullscreen
)
fileMenu
.
add
(
miToggleFullscreen
)
menu
.
add
(
miFullscreenState
)
fileMenu
.
add
(
miFullscreenState
)
menu
.
add
(
miTakeScreenshot
)
fileMenu
.
add
(
miTakeScreenshot
)
val
editMenu
=
JMenu
(
"Edit"
)
menuBar
.
add
(
editMenu
)
val
miEmojiAndSymbols
=
JMenuItem
(
"Emoji & Symbols"
)
miEmojiAndSymbols
.
setAccelerator
(
KeyStroke
.
getKeyStroke
(
"ctrl meta SPACE"
))
miEmojiAndSymbols
.
addActionListener
(
object
:
ActionListener
{
override
fun
actionPerformed
(
actionEvent
:
ActionEvent
?)
{
orderEmojiAndSymbolsPopup
()
}
})
editMenu
.
add
(
miEmojiAndSymbols
)
window
.
setJMenuBar
(
menuBar
)
window
.
setJMenuBar
(
menuBar
)
...
...
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/PlatformOperations.kt
View file @
fda59e1f
...
@@ -15,6 +15,7 @@ internal interface PlatformOperations {
...
@@ -15,6 +15,7 @@ internal interface PlatformOperations {
fun
isFullscreen
(
component
:
Component
):
Boolean
fun
isFullscreen
(
component
:
Component
):
Boolean
fun
setFullscreen
(
component
:
Component
,
value
:
Boolean
)
fun
setFullscreen
(
component
:
Component
,
value
:
Boolean
)
fun
disableTitleBar
(
platformInfo
:
Long
)
fun
disableTitleBar
(
platformInfo
:
Long
)
fun
orderEmojiAndSymbolsPopup
()
fun
getDpiScale
(
component
:
Component
):
Float
fun
getDpiScale
(
component
:
Component
):
Float
fun
createRedrawer
(
layer
:
SkiaLayer
,
renderApi
:
GraphicsApi
,
properties
:
SkiaLayerProperties
):
Redrawer
fun
createRedrawer
(
layer
:
SkiaLayer
,
renderApi
:
GraphicsApi
,
properties
:
SkiaLayerProperties
):
Redrawer
}
}
...
@@ -38,6 +39,10 @@ internal val platformOperations: PlatformOperations by lazy {
...
@@ -38,6 +39,10 @@ internal val platformOperations: PlatformOperations by lazy {
osxDisableTitleBar
(
platformInfo
)
osxDisableTitleBar
(
platformInfo
)
}
}
override
fun
orderEmojiAndSymbolsPopup
()
{
osxOrderEmojiAndSymbolsPopup
()
}
override
fun
createRedrawer
(
override
fun
createRedrawer
(
layer
:
SkiaLayer
,
layer
:
SkiaLayer
,
renderApi
:
GraphicsApi
,
renderApi
:
GraphicsApi
,
...
@@ -65,6 +70,9 @@ internal val platformOperations: PlatformOperations by lazy {
...
@@ -65,6 +70,9 @@ internal val platformOperations: PlatformOperations by lazy {
override
fun
disableTitleBar
(
platformInfo
:
Long
)
{
override
fun
disableTitleBar
(
platformInfo
:
Long
)
{
}
}
override
fun
orderEmojiAndSymbolsPopup
()
{
}
override
fun
getDpiScale
(
component
:
Component
):
Float
{
override
fun
getDpiScale
(
component
:
Component
):
Float
{
return
component
.
graphicsConfiguration
.
defaultTransform
.
scaleX
.
toFloat
()
return
component
.
graphicsConfiguration
.
defaultTransform
.
scaleX
.
toFloat
()
}
}
...
@@ -97,6 +105,9 @@ internal val platformOperations: PlatformOperations by lazy {
...
@@ -97,6 +105,9 @@ internal val platformOperations: PlatformOperations by lazy {
override
fun
disableTitleBar
(
platformInfo
:
Long
)
{
override
fun
disableTitleBar
(
platformInfo
:
Long
)
{
}
}
override
fun
orderEmojiAndSymbolsPopup
()
{
}
override
fun
getDpiScale
(
component
:
Component
):
Float
{
override
fun
getDpiScale
(
component
:
Component
):
Float
{
return
component
.
graphicsConfiguration
.
defaultTransform
.
scaleX
.
toFloat
()
return
component
.
graphicsConfiguration
.
defaultTransform
.
scaleX
.
toFloat
()
// TODO doesn't work well because java doesn't scale windows (content has offset with 200% scale)
// TODO doesn't work well because java doesn't scale windows (content has offset with 200% scale)
...
@@ -130,6 +141,7 @@ internal val platformOperations: PlatformOperations by lazy {
...
@@ -130,6 +141,7 @@ internal val platformOperations: PlatformOperations by lazy {
external
private
fun
osxIsFullscreenNative
(
component
:
Component
):
Boolean
external
private
fun
osxIsFullscreenNative
(
component
:
Component
):
Boolean
external
private
fun
osxSetFullscreenNative
(
component
:
Component
,
value
:
Boolean
)
external
private
fun
osxSetFullscreenNative
(
component
:
Component
,
value
:
Boolean
)
external
private
fun
osxDisableTitleBar
(
platformInfo
:
Long
)
external
private
fun
osxDisableTitleBar
(
platformInfo
:
Long
)
external
private
fun
osxOrderEmojiAndSymbolsPopup
()
// Linux
// Linux
external
private
fun
linuxGetDpiScaleNative
(
platformInfo
:
Long
):
Float
external
private
fun
linuxGetDpiScaleNative
(
platformInfo
:
Long
):
Float
skiko/src/jvmMain/kotlin/org/jetbrains/skiko/SkiaWindow.kt
View file @
fda59e1f
...
@@ -23,3 +23,7 @@ open class SkiaWindow(
...
@@ -23,3 +23,7 @@ open class SkiaWindow(
}
}
}
}
}
}
fun
orderEmojiAndSymbolsPopup
()
{
platformOperations
.
orderEmojiAndSymbolsPopup
()
}
\ No newline at end of file
skiko/src/jvmMain/objectiveC/macos/InputMethod.mm
0 → 100644
View file @
fda59e1f
#import "jni.h"
#import <Cocoa/Cocoa.h>
extern "C"
{
JNIEXPORT void Java_org_jetbrains_skiko_PlatformOperationsKt_osxOrderEmojiAndSymbolsPopup() {
dispatch_async(dispatch_get_main_queue(), ^{
NSApplication* app = [NSApplication sharedApplication];
[app orderFrontCharacterPalette:nil];
});
}
} // extern C
\ 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