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
52efd986
Commit
52efd986
authored
Jan 20, 2021
by
Igor Demin
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix crash in tests (remove unnecessary unknownWindows)
parent
d56864e2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
40 additions
and
26 deletions
+40
-26
App.kt
...kijaInjectSample/src/main/kotlin/SkijaInjectSample/App.kt
+1
-1
PureSwing.kt
...jectSample/src/main/kotlin/SkijaInjectSample/PureSwing.kt
+28
-0
SwingSkia.kt
...jectSample/src/main/kotlin/SkijaInjectSample/SwingSkia.kt
+1
-1
drawlayer.m
skiko/src/jvmMain/objectiveC/macos/drawlayer.m
+10
-24
No files found.
samples/SkijaInjectSample/src/main/kotlin/SkijaInjectSample/App.kt
View file @
52efd986
...
...
@@ -25,7 +25,7 @@ fun createWindow(title: String) = SwingUtilities.invokeLater {
var
mouseY
=
0
val
window
=
SkiaWindow
()
window
.
defaultCloseOperation
=
WindowConstants
.
EXIT
_ON_CLOSE
window
.
defaultCloseOperation
=
WindowConstants
.
DISPOSE
_ON_CLOSE
window
.
title
=
title
// Create menu.
...
...
samples/SkijaInjectSample/src/main/kotlin/SkijaInjectSample/PureSwing.kt
0 → 100644
View file @
52efd986
package
SkijaInjectSample
import
java.awt.BorderLayout
import
javax.swing.JFrame
import
javax.swing.WindowConstants
fun
pureSwing
()
{
val
window
=
JFrame
()
window
.
defaultCloseOperation
=
WindowConstants
.
DISPOSE_ON_CLOSE
window
.
setSize
(
800
,
600
)
window
.
contentPane
.
add
(
Button
(
"Skiko"
).
apply
{
addActionListener
{
createWindow
(
"Skiko"
)
}
},
BorderLayout
.
NORTH
)
window
.
contentPane
.
add
(
Button
(
"Swing"
).
apply
{
addActionListener
{
pureSwing
()
}
},
BorderLayout
.
WEST
)
window
.
contentPane
.
add
(
Button
(
"Swing+Skiko"
).
apply
{
addActionListener
{
SwingSkia
()
}
},
BorderLayout
.
EAST
)
window
.
setVisible
(
true
)
}
\ No newline at end of file
samples/SkijaInjectSample/src/main/kotlin/SkijaInjectSample/SwingSkia.kt
View file @
52efd986
...
...
@@ -19,7 +19,7 @@ fun Button(text: String): JButton {
fun
SwingSkia
()
=
SwingUtilities
.
invokeLater
{
val
window
=
JFrame
()
window
.
defaultCloseOperation
=
WindowConstants
.
EXIT
_ON_CLOSE
window
.
defaultCloseOperation
=
WindowConstants
.
DISPOSE
_ON_CLOSE
window
.
title
=
"SwingSkiaWindow"
val
panel
=
SkiaPanel
()
...
...
skiko/src/jvmMain/objectiveC/macos/drawlayer.m
View file @
52efd986
...
...
@@ -61,8 +61,6 @@
@end
NSMutableArray
*
unknownWindows
=
nil
;
NSMutableSet
*
layerStorage
=
nil
;
LayerHandler
*
findByObject
(
JNIEnv
*
env
,
jobject
object
)
...
...
@@ -120,33 +118,21 @@ JNIEXPORT void JNICALL Java_org_jetbrains_skiko_HardwareLayer_init(JNIEnv *env,
jobject
canvasGlobalRef
=
(
*
env
)
->
NewGlobalRef
(
env
,
canvas
);
[
layersSet
setCanvasGlobalRef
:
canvasGlobalRef
];
if
(
unknownWindows
==
nil
)
{
NSMutableArray
<
NSWindow
*>
*
windows
=
[
NSMutableArray
arrayWithArray
:
[[
NSApplication
sharedApplication
]
windows
]];
layersSet
.
window
=
[
windows
lastObject
];
[
windows
removeObject
:
layersSet
.
window
];
unknownWindows
=
windows
;
}
else
NSMutableArray
<
NSWindow
*>
*
windows
=
[
NSMutableArray
arrayWithArray
:
[[
NSApplication
sharedApplication
]
windows
]];
for
(
LayerHandler
*
value
in
layerStorage
)
{
NSMutableArray
<
NSWindow
*>
*
windows
=
[
NSMutableArray
arrayWithArray
:
[[
NSApplication
sharedApplication
]
windows
]];
for
(
NSWindow
*
value
in
unknownWindows
)
{
[
windows
removeObject
:
value
];
}
for
(
LayerHandler
*
value
in
layerStorage
)
if
(
layersSet
.
container
==
value
.
container
)
{
if
(
layersSet
.
container
==
value
.
container
)
{
layersSet
.
window
=
value
.
window
;
}
}
if
(
layersSet
.
window
==
NULL
)
{
layersSet
.
window
=
[
windows
lastObject
];
layersSet
.
window
=
value
.
window
;
}
}
if
(
layersSet
.
window
==
NULL
)
{
layersSet
.
window
=
[
windows
lastObject
];
}
[
layerStorage
addObject
:
layersSet
];
}
...
...
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