Skip to content

Commit

Permalink
remove webview and embed opengl in compose desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
sargunv committed Jan 5, 2025
1 parent 651db94 commit 25d3f62
Show file tree
Hide file tree
Showing 19 changed files with 99 additions and 735 deletions.
1 change: 0 additions & 1 deletion demo-app/.gitignore

This file was deleted.

11 changes: 0 additions & 11 deletions demo-app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -138,16 +138,5 @@ compose.desktop {
// packageVersion = project.ext["base_tag"].toString().replace("v", "")
packageVersion = "1.0.0"
}

// https://github.com/KevinnZou/compose-webview-multiplatform/blob/main/README.desktop.md#flags
jvmArgs("--add-opens", "java.desktop/sun.awt=ALL-UNNAMED")
jvmArgs(
"--add-opens",
"java.desktop/java.awt.peer=ALL-UNNAMED",
) // recommended but not necessary
if (System.getProperty("os.name").contains("Mac")) {
jvmArgs("--add-opens", "java.desktop/sun.lwawt=ALL-UNNAMED")
jvmArgs("--add-opens", "java.desktop/sun.lwawt.macosx=ALL-UNNAMED")
}
}
}
Original file line number Diff line number Diff line change
@@ -1,27 +1,18 @@
package dev.sargunv.maplibrecompose.demoapp

import androidx.compose.material3.ColorScheme
import androidx.compose.material3.Text
import androidx.compose.material3.darkColorScheme
import androidx.compose.material3.lightColorScheme
import androidx.compose.runtime.Composable
import androidx.compose.ui.window.singleWindowApplication
import dev.sargunv.maplibrecompose.compose.KcefProvider
import dev.sargunv.maplibrecompose.compose.MaplibreContextProvider

// TODO This should enable support for blending Compose over Swing views
// but it's just crashing on launch
// https://github.com/JetBrains/compose-multiplatform-core/pull/915#issuecomment-1954155894
// System.setProperty("compose.interop.blending", "true")

// -8<- [start:main]
fun main() {
singleWindowApplication {
KcefProvider(
loading = { Text("Performing first time setup ...") },
content = { MaplibreContextProvider { DemoApp() } },
)
}
// https://youtrack.jetbrains.com/issue/CMP-7352/
// System.setProperty("compose.interop.blending", "true")
// System.setProperty("compose.swing.render.on.graphics", "true") // TODO only on Linux
singleWindowApplication { MaplibreContextProvider { DemoApp() } }
}

// -8<- [end:main]
Expand Down
11 changes: 7 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ kermit = "2.0.5"
kotlinx-browser = "0.3"
kotlinx-coroutines = "1.10.1"
ktor = "3.0.3"
lwjgl = "3.3.5"
lwjglx-awt = "0.2.3"
maplibre-android-sdk = "11.7.1"
maplibre-android-plugins = "3.0.2"
maplibre-ios = "6.9.0"
maplibre-js = "4.7.1"
spatialk = "0.3.0"
webpack-html = "5.6.3"
webpack-htmlInlineScript = "3.2.1"
webview = "1.9.40"

gradle-android = "8.7.3"
gradle-compose = "1.7.3"
Expand All @@ -31,7 +30,6 @@ androidx-activity-compose = { module = "androidx.activity:activity-compose", ver
androidx-composeUi-testManifest = { module = "androidx.compose.ui:ui-test-manifest", version.ref = "androidx-composeUi" }
androidx-navigation-compose = { module = "org.jetbrains.androidx.navigation:navigation-compose", version.ref = "androidx-navigation" }
kotlinx-browser = { module = "org.jetbrains.kotlinx:kotlinx-browser", version.ref = "kotlinx-browser" }
webview = { module = "io.github.kevinnzou:compose-webview-multiplatform", version.ref = "webview" }
kermit = { group = "co.touchlab", name = "kermit", version.ref = "kermit" }
kotlinx-coroutines-android = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-android", version.ref = "kotlinx-coroutines" }
kotlinx-coroutines-swing = { group = "org.jetbrains.kotlinx", name = "kotlinx-coroutines-swing", version.ref = "kotlinx-coroutines" }
Expand All @@ -41,6 +39,11 @@ ktor-client-js = { module = "io.ktor:ktor-client-js", version.ref = "ktor" }
ktor-client-okhttp = { module = "io.ktor:ktor-client-okhttp", version.ref = "ktor" }
ktor-client-contentNegotiation = { module = "io.ktor:ktor-client-content-negotiation", version.ref = "ktor" }
ktor-serialization-kotlinxJson = { module = "io.ktor:ktor-serialization-kotlinx-json", version.ref = "ktor" }
lwjgl-core = { module = "org.lwjgl:lwjgl", version.ref = "lwjgl" }
lwjgl-jawt = { module = "org.lwjgl:lwjgl-jawt", version.ref = "lwjgl" }
lwjgl-opengl = { module = "org.lwjgl:lwjgl-opengl", version.ref = "lwjgl" }
lwjgl-vulkan = { module = "org.lwjgl:lwjgl-vulkan", version.ref = "lwjgl" }
lwjglx-awt = { module = "org.lwjglx:lwjgl3-awt", version.ref = "lwjglx-awt" }
maplibre-android = { module = "org.maplibre.gl:android-sdk", version.ref = "maplibre-android-sdk" }
maplibre-android-scalebar = { module = "org.maplibre.gl:android-plugin-scalebar-v9", version.ref = "maplibre-android-plugins" }
spatialk-geojson = { group = "io.github.dellisd.spatialk", name = "geojson", version.ref = "spatialk" }
Expand Down
4 changes: 0 additions & 4 deletions lib/maplibre-compose-webview/MODULE.md

This file was deleted.

42 changes: 0 additions & 42 deletions lib/maplibre-compose-webview/build.gradle.kts

This file was deleted.

This file was deleted.

This file was deleted.

32 changes: 0 additions & 32 deletions lib/maplibre-compose-webview/webpack.config.d/inline.js

This file was deleted.

Loading

0 comments on commit 25d3f62

Please sign in to comment.