https://kotlinlang.org logo
Docs
Join the conversationJoin Slack
Channels
100daysofcode
100daysofkotlin
100daysofkotlin-2021
advent-of-code
aem
ai
alexa
algeria
algolialibraries
amsterdam
android
android-architecture
android-databinding
android-studio
androidgithubprojects
androidthings
androidx
androidx-xprocessing
anime
anko
announcements
apollo-kotlin
appintro
arabic
argentina
arkenv
arksemdevteam
armenia
arrow
arrow-contributors
arrow-meta
ass
atlanta
atm17
atrium
austin
australia
austria
awesome-kotlin
ballast
bangladesh
barcelona
bayarea
bazel
beepiz-libraries
belgium
berlin
big-data
books
boston
brazil
brikk
budapest
build
build-tools
bulgaria
bydgoszcz
cambodia
canada
carrat
carrat-dev
carrat-feed
chicago
chile
china
chucker
cincinnati-user-group
cli
clikt
cloudfoundry
cn
cobalt
code-coverage
codeforces
codemash-precompiler
codereview
codingame
codingconventions
coimbatore
collaborations
colombia
colorado
communities
competitive-programming
competitivecoding
compiler
compose
compose-android
compose-desktop
compose-hiring
compose-ios
compose-mp
compose-ui-showcase
compose-wear
compose-web
connect-audit-events
corda
cork
coroutines
couchbase
coursera
croatia
cryptography
cscenter-course-2016
cucumber-bdd
cyprus
czech
dagger
data2viz
databinding
datascience
dckotlin
debugging
decompose
decouple
denmark
deprecated
detekt
detekt-hint
dev-core
dfw
docs-revamped
dokka
domain-driven-design
doodle
dsl
dublin
dutch
eap
eclipse
ecuador
edinburgh
education
effective-kotlin
effectivekotlin
emacs
embedded-kotlin
estatik
event21-community-content
events
exposed
failgood
fb-internal-demo
feed
firebase
flow
fluid-libraries
forkhandles
forum
fosdem
fp-in-kotlin
framework-elide
freenode
french
fritz2
fuchsia
functional
funktionale
gamedev
ge-kotlin
general-advice
georgia
geospatial
german-lang
getting-started
github-workflows-kt
glance
godot-kotlin
google-io
gradle
graphic
graphkool
graphql
graphql-kotlin
graviton-browser
greece
grpc
gsoc
gui
hackathons
hacktoberfest
hamburg
hamkrest
helios
helsinki
hexagon
hibernate
hikari-cp
hire-me
hiring
hongkong
hoplite
http4k
hungary
hyderabad
image-processing
india
indonesia
inkremental
intellij
intellij-plugins
intellij-tricks
internships
introduce-yourself
io
ios
iran
israel
istanbulcoders
italian
jackson-kotlin
jadx
japanese
jasync-sql
java-to-kotlin-refactoring
javadevelopers
javafx
javalin
javascript
jdbi
jhipster-kotlin
jobsworldwide
jpa
jshdq
juul-libraries
jvm-ir-backend-feedback
jxadapter
k2-early-adopters
kaal
kafka
kakao
kalasim
kapt
karachi
karg
karlsruhe
kash_shell
kaskade
kbuild
kdbc
kgen-doc-tools
kgraphql
kinta
klaxon
klock
kloudformation
kmdc
kmm-español
kmongo
knbt
knote
koalaql
koans
kobalt
kobweb
kodein
kodex
kohesive
koin
koin-dev
komapper
kondor-json
kong
kontent
kontributors
korau
korean
korge
korim
korio
korlibs
korte
kotest
kotest-contributors
kotless
kotlick
kotlin-asia
kotlin-beam
kotlin-by-example
kotlin-csv
kotlin-data-storage
kotlin-foundation
kotlin-fuel
kotlin-in-action
kotlin-inject
kotlin-latam
kotlin-logging
kotlin-multiplatform-contest
kotlin-mumbai
kotlin-native
kotlin-pakistan
kotlin-plugin
kotlin-pune
kotlin-roadmap
kotlin-samples
kotlin-sap
kotlin-serbia
kotlin-spark
kotlin-szeged
kotlin-website
kotlinacademy
kotlinbot
kotlinconf
kotlindl
kotlinforbeginners
kotlingforbeginners
kotlinlondon
kotlinmad
kotlinprogrammers
kotlinsu
kotlintest
kotlintest-devs
kotlintlv
kotlinultimatechallenge
kotlinx-datetime
kotlinx-files
kotlinx-html
kotrix
kotson
kovenant
kprompt
kraph
krawler
kroto-plus
ksp
ktcc
ktfmt
ktlint
ktor
ktp
kubed
kug-leads
kug-torino
kvision
kweb
lambdaworld_cadiz
lanark
language-evolution
language-proposals
latvia
leakcanary
leedskotlinusergroup
lets-have-fun
libgdx
libkgd
library-development
linkeddata
lithuania
london
losangeles
lottie
love
lychee
macedonia
machinelearningbawas
madrid
malaysia
mathematics
meetkotlin
memes
meta
metro-detroit
mexico
miami
micronaut
minnesota
minutest
mirror
mockk
moko
moldova
monsterpuzzle
montreal
moonbean
morocco
motionlayout
mpapt
mu
multiplatform
mumbai
munich
mvikotlin
mvrx
myndocs-oauth2-server
naming
navigation-architecture-component
nepal
new-mexico
new-zealand
newname
nigeria
nodejs
norway
npm-publish
nyc
oceania
ohio-kotlin-users
oldenburg
oolong
opensource
orbit-mvi
osgi
otpisani
package-search
pakistan
panamá
pattern-matching
pbandk
pdx
peru
philippines
phoenix
pinoy
pocketgitclient
polish
popkorn
portugal
practical-functional-programming
proguard
prozis-android-backup
pyhsikal
python
python-contributors
quasar
random
re
react
reaktive
realm
realworldkotlin
reductor
reduks
redux
redux-kotlin
refactoring-to-kotlin
reflect
refreshversions
reports
result
rethink
revolver
rhein-main
rocksdb
romania
room
rpi-pico
rsocket
russian
russian_feed
russian-kotlinasfirst
rx
rxjava
san-diego
science
scotland
scrcast
scrimage
script
scripting
seattle
serialization
server
sg-user-group
singapore
skia-wasm-interop-temp
skrape-it
slovak
snake
sofl-user-group
southafrica
spacemacs
spain
spanish
speaking
spek
spin
splitties
spotify-mobius
spring
spring-security
squarelibraries
stackoverflow
stacks
stayhungrystayfoolish
stdlib
stlouis
strife-discord-lib
strikt
students
stuttgart
sudan
swagger-gradle-codegen
swarm
sweden
swing
swiss-user-group
switzerland
talking-kotlin
tallinn
tampa
teamcity
tegal
tempe
tensorflow
terminal
test
testing
testtestest
texas
tgbotapi
thailand
tornadofx
touchlab-tools
training
tricity-kotlin-user-group
trójmiasto
truth
tunisia
turkey
turkiye
twitter-feed
uae
udacityindia
uk
ukrainian
uniflow
unkonf
uruguay
utah
uuid
vancouver
vankotlin
vertx
videos
vienna
vietnam
vim
vkug
vuejs
web-mpp
webassembly
webrtc
wimix_sentry
wwdc
zircon
Powered by Linen
compose-desktop
  • g

    Greg Steckman

    08/01/2022, 3:22 AM
    message has been deleted
    j
    l
    • 3
    • 20
  • l

    Lucas

    08/02/2022, 1:25 PM
    Can i run compose on a 32bit machine?
  • j

    Javier

    08/03/2022, 12:32 PM
    When is it planned to release a version which supports 1.7.10 without having to remove the warning? I don't care if it is dev version.
    b
    • 2
    • 5
  • j

    Jerry Yion

    08/03/2022, 12:52 PM
    Hi there
    id("org.jetbrains.kotlin.jvm") version "1.6.10"
        id("org.jetbrains.compose") version "1.0.0"
    Above is one part of my build.gradle content. It say
    This version (1.1.0-beta01) of the Compose Compiler requires Kotlin version 1.5.31 but you appear to be using Kotlin version 1.6.10 which is not known to be compatible
    when I ran build. The strange thing is I didn’t specify Compose 1.1.0-beta01 ( as you see, it’s 1.0.0
    s
    • 2
    • 1
  • s

    smallshen

    08/03/2022, 2:17 PM
    I'm trying to fix some code problems to make compose work with graalvm native-image. I followed this guide (https://github.com/JetBrains/compose-jb/blob/master/compose/README.md). But my intellij is not indexing the code correctly. I'm using WSL. Does anyone have experience with how to contribute code?
    k
    m
    • 3
    • 2
  • x

    xxfast

    08/04/2022, 12:57 AM
    Hi all. Im getting
    Caused by: org.jetbrains.skiko.LibraryLoadException: Cannot find libskiko-macos-arm64.dylib.sha256, proper native dependency missing.
    this can be fixed by changing build script to
    implementation(compose.desktop.macos_arm64)
    but that kinda defeats the multiplatform approach I'm using compose-jb version 1.2.0-alpha01-dev753
    e
    l
    • 3
    • 4
  • s

    spierce7

    08/04/2022, 4:13 AM
    Does anyone know how to have a Windows Compose for Desktop app always get administrator privledges?
  • s

    Sean Proctor

    08/04/2022, 4:23 PM
    I have a KMP project that I'm trying to move from compose 1.1.1 to 1.2.0-alpha01-dev753. It builds just fine, but IntelliJ displays an error for every compose class/function/annotation. Does anyone know how to fix that?
    m
    l
    d
    • 4
    • 16
  • e

    eygraber

    08/04/2022, 11:58 PM
    Is it possible to do something line Android's
    kotlinCompilerExtensionVersion
    for CfD? Meaning not for Android, but for other targets.
    s
    • 2
    • 3
  • j

    Jerry Yion

    08/05/2022, 9:34 AM
    Dose anyone met this problem?😂
    java.lang.ClassCastException: androidx.compose.runtime.internal.ComposableLambdaImpl cannot be cast to kotlin.jvm.functions.Function2
    	at androidx.compose.runtime.ActualJvm_jvmKt.invokeComposable(ActualJvm.jvm.kt:71)
    e
    • 2
    • 3
  • j

    Jerry Yion

    08/08/2022, 7:56 AM
    Hi all, which image loading lib do you use in the compose desktop project😆
    t
    • 2
    • 3
  • l

    Long Tran

    08/08/2022, 8:11 AM
    H guys, I got an issue with the
    LazyListState.isScrollInProgress
    , it always returns false even if the list is clearly scrolling. I saw this ticket on GitHub but it seems no hope. (https://github.com/JetBrains/compose-jb/issues/1423) Is there any workaround to fix this? please give me help. Thank you!!
    a
    • 2
    • 1
  • o

    orangy

    08/08/2022, 11:39 AM
    Does anyone have a Text-like component, that is capable of handling links (urls) inside? I have
    AnnotatedString
    with some url annotations, and I’m struggling to make it working properly with hover interactions. I want (like in a browser) to highlight links when they are hovered, and change pointer icon to hand. It causes infinite recomposition because when I handle enter/move pointer event, the
    AnnotatedString
    is changed (to highlight hovered part of the text with url), which causes recomposition of
    BasicText
    , and then
    onTextLayout
    yields different
    TextLayoutResult
    (because input changed, particularly span styles), which causes remembered mutable state to be modified, which triggers more changes and causes recomposition again, ad infinum. Also, it seems recomposition causes synthentic
    PointerEventType.Exit
    to be sent, which causes un-hover path to be triggered. I just can’t find how to get it all together. Any ideas, maybe?
    a
    • 2
    • 7
  • b

    Big Chungus

    08/09/2022, 9:34 AM
    How does one go about setting up tests in CfD + Jetpack compose project? I'm getting
    java.lang.NoClassDefFoundError: Could not initialize class androidx.test.espresso.Espresso
    when trying to run
    androidTest
    tests.
    g
    • 2
    • 1
  • l

    Lucas

    08/09/2022, 3:45 PM
    I'm recieving a fatal crash when launching app on windows 10 (only one user experiencing this) Any ideias how i could fix this? Doesnt seem to be related to my application
    k
    • 2
    • 5
  • s

    spierce7

    08/09/2022, 7:43 PM
    I need to be able to modify a compose desktop executable before it’s packaged into an MSI. I need to alter the compiled manifest, so I can set the
    requestedExecutionLevel
    1. Is it possible to modify / set the executable’s manifest through an option? (I don’t think it is) 2. Is it possible to modify the contents before it’s packaged into an MSI?
  • k

    Kirill Grouchnikov

    08/09/2022, 10:01 PM
    @Igor Demin - hopefully https://github.com/JetBrains/compose-jb/issues/2237 that I just filed can be fixed before 1.2.0 hits the stable release. This is needed to properly support theming (dark or otherwise) without a flash of grey when
    ComposePanel
    is used.
    i
    t
    • 3
    • 6
  • b

    Bino

    08/10/2022, 7:43 AM
    :compose: 🖥️ Does anyone has experience with Compose for Desktop and using a native c library? I was able to load the native library desktop
    val resources = File(System.getProperty("compose.application.resources.dir")).parent
    System.load(File(resources, "libutil.dylib").absolutePath)
    But I don’t know how I can access it.
    r
    l
    • 3
    • 4
  • o

    orangy

    08/10/2022, 10:23 AM
    It seems
    ClickableText
    doesn’t work inside
    SelectionContainer
    . Is there something I’m missing, or is it a bug? Any workaround?
    s
    • 2
    • 4
  • o

    Oleksandr Karpovich [JB]

    08/12/2022, 11:10 AM
    Hi everyone! 🙂 We’re trying to improve our understanding of user experience when it comes to text typing (especially bidirectional text). And that’s why we’d like to ask you to participate in a small poll about the text typing using different languages (writing systems). Thank you for your help! Let’s say you need to type a message in a language that uses NON-LATIN script (e.g. Arabic, Cyrillic, Hebrew, etc.) on your smartphone or PC/laptop. Given the message in English “I like Kotlin and Compose for Desktop!“, how would you type it in your preferred (maybe native) language for a casual/informal purpose? Please choose a variant (1-6) and/or type your translation in the thread. (1-3) for left-to-right languages ➡️ : 1️⃣ ➡️ - No mix: I transliterate the words “*Kotlin*” and “*Compose for Desktop*” into the alphabet of my language 2️⃣ ➡️- Mix: I switch languages and type the both words “*Kotlin*” and “*Compose for Desktop*” using the LATIN script 3️⃣ ➡️- Partial Mix: I transliterate some part(s) and type another parts using the LATIN script (4-6) for right-to-left languages (e.g. Arabic, Hebrew, etc.) ⬅️ 4️⃣ ⬅️ - No mix: I transliterate the words “*Kotlin*” and “*Compose for Desktop*” into the alphabet of my language 5️⃣ ⬅️ - Mix: I switch languages and type the both words “*Kotlin*” and “*Compose for Desktop*” using the LATIN script 6️⃣ ⬅️ - Partial Mix: I transliterate some part(s) and type another parts using the LATIN script Would you type it differently for a formal purpose (e.g. for a post in a blog)? If it’s different, please share your formal and informal variants in the thread. Thank you 🙂
    k
    • 2
    • 2
  • l

    Lucas

    08/12/2022, 3:32 PM
    Can i start a compose dialog from a javafx application? I tried but i'm getting
    java.lang.RuntimeException: java.lang.reflect.InvocationTargetException
    Caused by: java.lang.NoClassDefFoundError: Could not initialize class androidx.compose.ui.awt.ComposeLayer$ComponentImpl
    • 1
    • 1
  • e

    enighma

    08/12/2022, 7:23 PM
    TLDR; how do I create a distributable image for another MacOS platform I have a compose desktop project and I want to create a dmg for x64 macs (mine is m1). Is all I need to do change:
    implementation(compose.desktop.currentOs)
    to
    implementation(compose.desktop.macos_x64)
    and run the gradle task:
    packageDmg
    ? Because when I had someone try the dmg file, the app had a cross over it.
    t
    s
    • 3
    • 12
  • c

    CLOVIS

    08/13/2022, 3:33 PM
    Has anyone seen
    Exception in thread "main" java.lang.ClassCastException: class androidx.compose.runtime.internal.ComposableLambdaImpl cannot be cast to class kotlin.jvm.functions.Function0 (androidx.compose.runtime.internal.ComposableLambdaImpl and kotlin.jvm.functions.Function0 are in unnamed module of loader 'app')
    before?
    e
    • 2
    • 3
  • s

    spierce7

    08/13/2022, 11:25 PM
    Is there an image loader yet that people are using for Kotlin Multiplatform?
    m
    i
    +2
    • 5
    • 11
  • j

    Jerry Yion

    08/15/2022, 7:48 AM
    Hi there, I created a compose multiplatform project. It ran well on macOS however was not abled to build on Windows successfully
    Task :desktop:compileKotlinJvm FAILED
    e: org.jetbrains.kotlin.protobuf.InvalidProtocolBufferException: Protocol message contained an invalid tag (zero).
  • r

    redenergy

    08/19/2022, 9:25 PM
    Hey! I need a bit a of heads up from experienced compose users. So, I have a pretty large desktop application with lots of screens (=views), about 150 total. We're hoping to start gradual migration to Compose and I am playing around with it to figure out how views should be architectured. Usually you'll have some kind of storage for data which is used in the UI, depending on the architure pattern it is often called Model or something like that. Additionally, you'll have something which performs actual logic of the UI, it can be called a Controller, or something similiar to that. And of course you have a View, something which defines the visuals of the UI and it's presentation. Depending on the approach (MVC/MVVM/MVA/etc) these entities can be called and organized differently but in the end you have a data, which can be operated upon in some way, and presented to the user somehow. Most of our current UI is written in such a way, that data and all UI logic is kept in a single class, which nicely encapsulates whole UI state and operations. We would like to continue doing our UIs the same way - it is familiar to all our developers and also will simplify things during the migrations process. Now to my question, while skimming through various examples and playing with compose a bit I found it difficult to figure out how to organize 'Model' and 'Controller' in a single class. I don't have much experience with jetpack on Android, but the thing I am looking for seems to be usually referred as ModelView. However, I can't find any good examples of ModelView in compose for desktop application thus I can't really understand if it actually the thing which would suit our goals. - Are there any good, bite-sized examples of ModelView pattern with compose for desktop application? - If ModelView approach is not actually the thing I am looking for, what would be the best approach to encapsulate business logic and UI state in a single class while allowing it to freely communicate with external systems of the application?
    l
    m
    y
    • 4
    • 5
  • o

    orangy

    08/20/2022, 10:07 AM
    You need either Compose Multiplatform plugin from marketplace to get this and preview, or you can try a more sophisticated but unreleased custom built one here https://kotlinlang.slack.com/archives/C01D6HTPATV/p1659032360396019
    e
    • 2
    • 1
  • a

    andylamax

    08/21/2022, 5:59 AM
    Hello fellas, I am stuck at
    An exception occurred applying plugin request [id: 'org.jetbrains.compose']
    > Failed to apply plugin 'org.jetbrains.compose'.
       > Cannot add extension with name 'compose', as there is an extension already registered with that name.
    I have a project level build.gradle.kts file with just
    plugins {
        id("org.jetbrains.compose") version "1.2.0-alpha01-dev755" apply false
        // other plugins here
    }
    and, I have a sub project gradle plugin
    plugins {
        id("org.jetbrains.compose")
        // other plugins here
    }
    I can't seem to find any other plugin that defines the "compose" extension. What am I doing wrong?
    • 1
    • 1
  • x

    xxfast

    08/22/2022, 7:22 AM
    Which sourceset are you trying to import that in?
    l
    • 2
    • 1
  • r

    redenergy

    08/22/2022, 9:57 PM
    What would be a solution for cases when you need to render some 3D scene (using OpenGL) inside a compose widget? I've seen lwjgl integration example, it was very helpful with understanding how to use CfD in opengl applications and I plan to use it in my solution. However, I need to somehow get callback every frame of compose rendering (from Skia?) when my specific widget is shown. It would be ideal if it was possible to render directly into active skia's framebuffer without any unneccessary image copies. So far I've only been able to find this example of 3D rendering inside of compose: https://github.com/romainguy/sample-materials-shop, but it is specific for Android and does some trickery with AndroidView, I need something similiar for desktop.
    e
    r
    • 3
    • 16
Powered by Linen
Title
r

redenergy

08/22/2022, 9:57 PM
What would be a solution for cases when you need to render some 3D scene (using OpenGL) inside a compose widget? I've seen lwjgl integration example, it was very helpful with understanding how to use CfD in opengl applications and I plan to use it in my solution. However, I need to somehow get callback every frame of compose rendering (from Skia?) when my specific widget is shown. It would be ideal if it was possible to render directly into active skia's framebuffer without any unneccessary image copies. So far I've only been able to find this example of 3D rendering inside of compose: https://github.com/romainguy/sample-materials-shop, but it is specific for Android and does some trickery with AndroidView, I need something similiar for desktop.
e

enighma

08/22/2022, 10:10 PM
This will be a bit tricky, because OpenGL requires an OpenGL context, and creating a context is platform specific. My first question is which OpenGL API you're using? I.e. Do you intend to write OpenGL C code and use JNI? or use a Java wrapper? The first step you'd want to look into is to see how you can create an OpenGL context from a java swing context. In the end what you probably want is something similar to Android GLSurfaceView, but that works on deskop. However, this is extra tricky since not all OSes have OpenGL Drivers, most notably MacOS
r

redenergy

08/22/2022, 10:31 PM
To reduce ambiguity, let's assume that Windows is the only target platform. Application itself is written in java and uses LWJGL as OpenGL wrapper, and also relies on glfw's context creation abstraction. For now, I am using code from this example - https://github.com/JetBrains/compose-jb/blob/master/experimental/lwjgl-integration/src/main/kotlin/main.kt for GLFW, OpenGL and Skia initialization and rendering. So my question boils down to achieving something similiar to GLSurfaceView. I actually was hoping that it already exists and I just missed while searching the api.
r

romainguy

08/22/2022, 11:58 PM
Filament works on other platforms
But you'd need to build the JVM integration
We used to have one you could get inspiration from that
Basically it's using JNI to get the native pointer of an awt component
Note that you can't just share the Skia back buffer (or at least not easily)
Here's our JVM code:
https://github.com/google/filament/tree/v1.5.0/java/filament/src/java/com/google/android/filament
e

enighma

08/23/2022, 12:02 AM
@redenergy I think it's safe to say that you haven't missed any API. So, not matter which approach you'll choose, you will have to do something novel
r

romainguy

08/23/2022, 12:02 AM
There are two techniques: rendering directly into an awt window or copying to a buffered image
JNI here: https://github.com/google/filament/blob/v1.5.0/android/filament-android/src/main/cpp/nativewindow/JAWTUtils.cpp
r

redenergy

08/23/2022, 12:18 AM
@romainguy I do not intend to use filament specifically, your project with filament integration inside of compose was just a pretty good example of what I want to achieve. I guess my question is more about sharing framebuffer with skia and accessing it for rendering inside the widget. I won't use awt so drawing to it's window is not really an option, and copying to buffered image on cpu is really wasteful, would like to avoid it.
r

romainguy

08/23/2022, 12:42 AM
I would not try to share the Skia buffer, for a number of reasons. I was pointing to our code as an example because you usually either want to render in a separate surface (an AWT component for instance, if Compose for Desktop provides interop which I assume it does) or you need to do a composition step using some kind of shared texture. I don't think CfD exposes anything for this yet
r

redenergy

08/23/2022, 11:53 PM
@SrSouza I apologize in advance for pinging. I've found your discussion in which you've tried to solve basically the same problem (rendering OpenGL inside of compose component) and wanted to ask if you've managed to solve it somehow.
One possible solution could be implemented by using lwjgl3-awt integration but it can't be used if compose is not executed inside of AWT window. At least that was my impression since SwingPanel, which would be used to instantiate AWTGLCanvas, requires owning awt Container when created and I am trying to use compose for UI in OpenGL application.
View count: 8