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
  • a

    Aaron Yoder

    04/07/2021, 2:52 AM
    Canvas/Scrollbar question: I was looking at the Scrollbar tutorial in the compose-jb repository and came up with
    val stateVertical = rememberScrollState(0)
            val stateHorizontal = rememberScrollState(0)
            Box(modifier = Modifier.verticalScroll(stateVertical).padding(end = 12.dp, bottom = 12.dp).horizontalScroll(stateHorizontal)) {
                Canvas(modifier = Modifier.size(width.dp, height.dp) {
                    drawIntoCanvas { canvas ->
    					// draw things
                    }
                }
            }
            VerticalScrollbar(modifier = Modifier.fillMaxHeight(), adapter = rememberScrollbarAdapter(stateVertical))
            HorizontalScrollbar(modifier = Modifier.fillMaxWidth().padding(end = 12.dp), adapter = rememberScrollbarAdapter(stateHorizontal))
    I'm not sure if this is the proper way to implement a scrollable canvas, because while it does seem to scroll across the canvas fine, there don't appear to be any visual scrollbars, just empty space on the bottom and right sides of the global canvas, rather than relative to the window. The other issue I was having was that I was putting a
    pointerMoveFilter
    modifier on the canvas modifier to get x, y coordinates in the canvas, which apparently isn't the proper way to do it because when adding scroll bars the coordinates of the top-left position are always 0, 0 regardless of where that actually might be on the canvas. I feel like I'm definitely misunderstanding something about scrollbars here. Are they only meant for scrolling through a list, and not across an image? How would I correctly implement it for a canvas, and is there a proper method of getting the relative-to-Canvas x, y coordinates?
    i
    2 replies · 2 participants
  • t

    theapache64

    04/07/2021, 9:07 AM
    not getting
    KEY_PRESSED
    (but getting
    KEY_RELEASED
    ) for the first key event. 🤔 Is this expected ?
    a
    2 replies · 2 participants
  • c

    Colton Idle

    04/07/2021, 11:39 AM
    Using latest IJ 2021.1 that came out today. I select JDK 14 and then advance through the wizard and it only gives me option to go up to 13. Is that a bug?
    c
    e
    6 replies · 3 participants
  • h

    Halil Ozercan

    04/07/2021, 10:03 PM
    Hey everyone, I'm trying to show a notification in Windows and official example is giving me
    The os does not support: 'Taskbar.setIconImage'
    error. What could be the problem?
    t
    1 reply · 2 participants
  • t

    theapache64

    04/07/2021, 10:48 PM
    🚨 If i add 
    fillMaxSize
     ,the 
    onKeyEvent
     not getting called. Is this expected?
    s
    1 reply · 2 participants
  • j

    jim

    04/08/2021, 8:32 AM
    definitely file a bug (and please include a minimal repro) for that one!
    h
    1 reply · 2 participants
  • f

    Felipe Gaiad

    04/09/2021, 1:39 AM
    For those who use MVVM as architecture for CfD, what do you usually use to replace the livedata to observe changes in state at the viewmodel properties?
    t
    t
    +1
    4 replies · 4 participants
  • c

    Colton Idle

    04/09/2021, 8:34 AM
    Does the template that the IJ wizard generates live on github? 1. It generates a crashing android build on launch of the app 2. The root build file looks different (and simpler) than https://github.com/JetBrains/compose-jb/blob/master/templates/multiplatform-template/build.gradle.kts I suppose asking "which one is right" is a dumb question? I guess I would prefer trying to adopt the simpler one.
    j
    3 replies · 2 participants
  • h

    Hyia

    04/09/2021, 9:31 AM
    does idea support
    @Preview
    now?
    t
    c
    +1
    4 replies · 4 participants
  • c

    Colton Idle

    04/09/2021, 10:16 AM
    When creating a compose desktop app using the wizard and selecting "Multiplatform" I was actually really surprised that android/build.gradle.kts and common/build.gradle.kts both have android deps in them. android has
    dependencies {
        implementation(project(":common"))
        implementation("androidx.activity:activity-compose:1.3.0-alpha03")
    }
    Which makes sense. android module depends on common module. and also activity compose lib. cool. But then common has
    val androidMain by getting {
                dependencies {
                    api("androidx.appcompat:appcompat:1.2.0")
                    api("androidx.core:core-ktx:1.3.1")
                }
            }
    That seems... wrong? Should appcompat and core be directly in android build file? As an experiment I just commented out those /common android deps and placed them in /android build file and everything works. again... leaving me confused as to why have the android deps in two places?
    j
    5 replies · 2 participants
  • v

    v79

    04/09/2021, 8:30 PM
    How do you 'remember' something which could be null (and probably will be initially?). I.E. can you remember a class, but not an instance of it?
    var something = remember { mutableStateOf<MyClass>(_* can't construct here because it's currently null *_) }
    ?
    e
    b
    13 replies · 3 participants
  • h

    Hyia

    04/10/2021, 3:23 AM
    How can I hide the scrollbar automatically, seems no config now. Or should i use LazyScroll?
    i
    8 replies · 2 participants
  • t

    theapache64

    04/10/2021, 7:44 AM
    This could be a dumb question 😬. How do I
    drawImage
    (
    Canvas
    ) with "pixelated" output?
    r
    a
    +1
    18 replies · 4 participants
  • t

    theapache64

    04/10/2021, 10:45 AM
    If we ask
    Canvas
    to draw beyond visible area, would it draw that OR skip it? For example. let's say my window size is 100x100, and I ask
    Canvas
    to
    drawImage
    at
    1000x1000
    , so would it draw that OR ignore that call since its outside the window size?
    i
    n
    7 replies · 3 participants
  • t

    theapache64

    04/10/2021, 11:32 AM
    Would it be better If I move
    IntOffset
    or
    IntSize
    (object creation) to outside the
    DrawScope
    ? I mean, will there any notable performance difference if I move these measurement classes outside the
    DrawScope
    drawImage(
        image = R.graphics.brickPng,
        dstOffset = IntOffset(floorBrick.x, floorBrick.y), // or should I call `floorBrick.intOffset?` (where intOffset created only one time)
    )
    i
    o
    +1
    13 replies · 4 participants
  • b

    Bahaa Kallas

    04/10/2021, 4:26 PM
    I have created multiplatform compose project using the project wizard but the produced project seems to be not runnable on desktop (It runs on Android). The desktop target has a "runtime exception" when trying to run it using the gradle task "run" of the desktop module Here is the error shown in logs
    Process 'command 'C:\Program Files\JetBrains\IntelliJ IDEA 2019.3.1\jbr\bin\java.exe'' finished with non-zero exit value 1
    and a log file is generated inside the module directory which contains some crap which is not quite readable (for me) I have IntelliJ IDEA 2020.3.3 (Ultimate Edition) Build #IU-203.7717.56 installed and I am working on Windows 10 machine Any ideas whether this is a local issue or the project produced by the wizard is not configured correctly Thanks in advance
    1 reply · 1 participant
  • c

    Colton Idle

    04/11/2021, 2:24 AM
    For whatever it's worth. Don't move to gradle 7 yet. Android builds with jb compose seem to work, but desktop fails (using the MP template from github)
    a
    1 reply · 2 participants
  • v

    v79

    04/11/2021, 11:45 AM
    I think I'd pay for a code-review service...
    ❓ 2
    c
    1 reply · 2 participants
  • g

    gbaldeck

    04/12/2021, 12:56 AM
    Today I released version 0.1.0 of my hobby project Grim Locations. It is a tool for the game Grim Dawn that uses compose for desktop, coroutines, and exposed with Sqlite. I'd like to say thank you to you all. I have asked many questions in this channel and without you all's help this release wouldn't have been possible. Demo video: https://imgur.com/RUcxB0U Source Code: https://github.com/recursivelftr/Grim-Locations
    🎉 5
    :party-parrot: 2
    t
    1 reply · 2 participants
  • m

    moz

    04/12/2021, 2:56 AM
    Is there an API to play audio using compose desktop? I got an mp3 file that I'd like to play on the background when a button click occurs.
    j
    2 replies · 2 participants
  • i

    Icyrockton

    04/12/2021, 4:16 AM
    Is there a way support @Composable function green icon in IDEA , just like in android studio?
    o
    o
    +1
    3 replies · 4 participants
  • t

    theapache64

    04/12/2021, 8:29 AM
    👷 I am trying to build super mario bros using compose desktop 🥼 Twitter : https://twitter.com/theapache64/status/1380809842114265088 (for updates) GitHub : https://github.com/theapache64/compose-mario 🚧
    🎉 4
    👍🏼 2
    🆒 7
    🔥 3
    🏃 13
    👍 28
    ❤️ 9
    g
    4 replies · 2 participants
  • s

    spierce7

    04/13/2021, 1:07 AM
    Has anyone tried to get hot reload working with desktop compose?
    👀 3
    o
    t
    2 replies · 3 participants
  • o

    olonho

    04/13/2021, 9:37 AM
    please do not migrate to
    0.4.0-build181
    , as due to upstream changes it isn’t usable
    🆗 7
    a
    3 replies · 2 participants
  • s

    spierce7

    04/13/2021, 4:13 PM
    GraalVM native-images apparently supports Swing applications with the java 16 variant in dev builds. I’m curious, has anyone tried it yet for compose-desktop?
    j
    a
    +2
    12 replies · 5 participants
  • d

    Deklan Webster

    04/13/2021, 6:43 PM
    how would a mobile/desktop multiplatform app work with Kotlin + Jetpack Compose? Say, targeting iOS/Android/Windows/Mac? Business logic in Kotlin, Compose for everything except iOS, and then write the iOS view layer with Swift UI or whatever?
    s
    a
    +3
    15 replies · 6 participants
  • d

    Deklan Webster

    04/13/2021, 6:43 PM
    More daringly, has anyone attempted this?
    j
    c
    +1
    5 replies · 4 participants
  • k

    Kirill Grouchnikov

    04/14/2021, 5:48 AM
    But more importantly
    👍 11
    👍🏼 1
    a
    a
    2 replies · 3 participants
  • a

    Arslan Armanuly

    04/14/2021, 11:51 AM
    Is there any webview library for the compose for desktop?
    a
    o
    +1
    8 replies · 4 participants
  • k

    Kirill Grouchnikov

    04/14/2021, 2:24 PM
    🙀
    :jetpack-compose: 3
    :party-parrot: 2
    😻 7
    o
    a
    +1
    12 replies · 4 participants
Powered by Linen
Title
k

Kirill Grouchnikov

04/14/2021, 2:24 PM
🙀
:jetpack-compose: 3
:party-parrot: 2
😻 7
o

olonho

04/14/2021, 2:53 PM
It’s a side effect of bug leading to https://kotlinlang.slack.com/archives/C01D6HTPATV/p1618306635028100, not any statement on our side
a

alexey.tsvetkov

04/14/2021, 5:56 PM
1.0.0-alpha01
artifacts were published unwillingly, because of a change in the mainline. The
1.0.0-alpha01
artifacts are deleted now.
k

Kirill Grouchnikov

04/14/2021, 6:13 PM
➕ 4
😅 3
h

hfhbd

04/19/2021, 4:40 PM
Could you please delete 0.4.0-preview-annotation-build56 too? AFAIK it was a GitHub release test, but dependabot thinks, it is the latest version and does not create new Pull request.
a

alexey.tsvetkov

04/20/2021, 7:04 AM
@hfhbd done
👍 1
k

Kirill Grouchnikov

04/20/2021, 1:17 PM
Now it treats
0.4.0-preview-annotation-build55
as the latest
h

hfhbd

04/20/2021, 1:21 PM
@alexey.tsvetkov did you only delete the
56
build? 😄 <version>0.4.0-preview-annotation-build56</version> <version>0.4.0-preview-annotation-build55</version> <version>0.4.0-preview-annotation-build53</version>
a

alexey.tsvetkov

04/20/2021, 1:23 PM
Oops, sorry, I forgot about these 😅
All
0.4.0-preview-annotation-*
versions are removed.
Wait, there is also
0.4.0-idea-preview-build57
All weird
0.4.0-*
versions should be deleted now
h

hfhbd

04/20/2021, 3:49 PM
It is:
updater | INFO <job_111337542> Latest version is 0.4.0-build184
🎉
View count: 4