Skip to content

Commit a900356

Browse files
committed
Enable Windows support in wrywebview, improve dependency handling, and add platform-specific event pumps
1 parent d2c1f0d commit a900356

8 files changed

Lines changed: 227 additions & 35 deletions

File tree

demo/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ kotlin {
2828
implementation(compose.desktop.currentOs)
2929
implementation(libs.kotlinx.coroutinesSwing)
3030
implementation(project(":wrywebview-compose"))
31+
implementation(project(":wrywebview"))
32+
3133
}
3234
}
3335
}

demo/src/jvmMain/kotlin/io/github/kdroidfilter/composewebview/main.kt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ import androidx.compose.ui.window.Window
44
import androidx.compose.ui.window.application
55

66
fun main() {
7-
System.setProperty("compose.swing.render.on.graphics", "true")
8-
System.setProperty("compose.interop.blending", "true")
7+
// System.setProperty("compose.swing.render.on.graphics", "true")
8+
// System.setProperty("compose.interop.blending", "true")
99

1010
application {
1111

wrywebview-compose/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ kotlin {
1212
implementation(compose.runtime)
1313
implementation(compose.ui)
1414
implementation(compose.desktop.currentOs)
15-
implementation(project(":wrywebview"))
15+
api(project(":wrywebview"))
1616
}
1717
}
1818
}

wrywebview/Cargo.lock

Lines changed: 153 additions & 24 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

wrywebview/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ gtk = "0.18"
2020
[target.'cfg(target_os = "macos")'.dependencies]
2121
dispatch2 = "0.3.0"
2222
objc2 = "0.6"
23+
24+
[target.'cfg(target_os = "windows")'.dependencies]
25+
windows = { version = "0.58", features = ["Win32_UI_WindowsAndMessaging"] }

wrywebview/src/main/java/io/github/kdroidfilter/composewebview/wry/SkikoInterop.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,17 @@ final class SkikoInterop {
88
private SkikoInterop() {}
99

1010
static Canvas createHost() {
11+
if (isWindows()) {
12+
return new Canvas();
13+
}
1114
return new HardwareLayer();
1215
}
1316

17+
private static boolean isWindows() {
18+
String osName = System.getProperty("os.name");
19+
return osName != null && osName.toLowerCase().contains("windows");
20+
}
21+
1422
static long getContentHandle(Component component) {
1523
if (component instanceof HardwareLayer) {
1624
return ((HardwareLayer) component).getContentHandle();

0 commit comments

Comments
 (0)