Browse Source

CEF to dev97

pull/35/head
Nikolay Igotti 4 years ago
parent
commit
765c1fd86d
  1. 4
      cef/build.gradle.kts
  2. 2
      cef/settings.gradle.kts
  3. 1
      cef/src/main/kotlin/org/jetbrains/compose/desktop/App.kt
  4. 4
      cef/src/main/kotlin/org/jetbrains/compose/desktop/browser/BrowserState.kt
  5. 6
      cef/src/main/kotlin/org/jetbrains/compose/desktop/browser/CefView.kt

4
cef/build.gradle.kts

@ -5,7 +5,7 @@ import kotlin.text.capitalize
plugins { plugins {
kotlin("jvm") version "1.4.0" kotlin("jvm") version "1.4.0"
id("org.jetbrains.compose") version "0.1.0-unmerged30" id("org.jetbrains.compose") version "0.1.0-dev97"
id("de.undercouch.download") version "4.1.1" id("de.undercouch.download") version "4.1.1"
application application
} }
@ -42,6 +42,8 @@ val cefUnZip = run {
repositories { repositories {
google() google()
jcenter() jcenter()
maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
// temp
maven("https://packages.jetbrains.team/maven/p/ui/dev") maven("https://packages.jetbrains.team/maven/p/ui/dev")
} }

2
cef/settings.gradle.kts

@ -1,7 +1,7 @@
pluginManagement { pluginManagement {
repositories { repositories {
gradlePluginPortal() gradlePluginPortal()
maven("https://packages.jetbrains.team/maven/p/ui/dev") maven("https://maven.pkg.jetbrains.space/public/p/compose/dev")
} }
} }

1
cef/src/main/kotlin/org/jetbrains/compose/desktop/App.kt

@ -65,7 +65,6 @@ private fun AddressBar() {
) )
Spacer(Modifier.width(10.dp)) Spacer(Modifier.width(10.dp))
Button( Button(
backgroundColor = Color(16, 180, 140),
modifier = Modifier.preferredHeight(48.dp), modifier = Modifier.preferredHeight(48.dp),
shape = CircleShape, shape = CircleShape,
onClick = { BrowserState.loadURL(BrowserState.url.value) } onClick = { BrowserState.loadURL(BrowserState.url.value) }

4
cef/src/main/kotlin/org/jetbrains/compose/desktop/browser/BrowserState.kt

@ -25,7 +25,7 @@ object BrowserState {
fun loadURL(url: String) { fun loadURL(url: String) {
if (!isReady.value) { if (!isReady.value) {
val app = AppManager.getCurrentFocusedWindow() val app = AppManager.focusedWindow
if (app != null) { if (app != null) {
init(app, url) init(app, url)
} }
@ -86,4 +86,4 @@ object BrowserState {
} }
return null return null
} }
} }

6
cef/src/main/kotlin/org/jetbrains/compose/desktop/browser/CefView.kt

@ -19,7 +19,7 @@ import androidx.compose.ui.Modifier
import org.jetbrains.skija.IRect import org.jetbrains.skija.IRect
import org.jetbrains.skija.Bitmap import org.jetbrains.skija.Bitmap
import androidx.compose.ui.graphics.drawscope.drawCanvas import androidx.compose.ui.graphics.drawscope.drawIntoCanvas
import androidx.compose.ui.graphics.nativeCanvas import androidx.compose.ui.graphics.nativeCanvas
import androidx.compose.runtime.getValue import androidx.compose.runtime.getValue
@ -87,7 +87,7 @@ fun CefCanvas(bitmap: Bitmap, browser: BrowserState) {
.focus() .focus()
.clickable(indication = null) { focusRequester.requestFocus() } .clickable(indication = null) { focusRequester.requestFocus() }
) { ) {
drawCanvas { canvas, size -> drawIntoCanvas { canvas ->
canvas.nativeCanvas.drawBitmapRect(bitmap, IRect(0, 0, width.value, height.value).toRect()) canvas.nativeCanvas.drawBitmapRect(bitmap, IRect(0, 0, width.value, height.value).toRect())
} }
} }
@ -103,4 +103,4 @@ private fun Modifier.onResized(browser: BrowserState) = Modifier.layout { measur
layout(placeable.width, placeable.height) { layout(placeable.width, placeable.height) {
placeable.placeRelative(0, 0) placeable.placeRelative(0, 0)
} }
} }

Loading…
Cancel
Save