https://kotlinlang.org logo
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
  • s

    Sean Proctor

    07/08/2022, 5:54 PM
    Has anyone written a window-in-window layout manager for compose? I'm porting an app from JFace/SWT and I'm missing the ability to have tabbed panels that can be dragged/resized. SplitPane gets part of the way there.
    k
    • 2
    • 2
  • m

    Michael Paus

    07/09/2022, 8:52 AM
    I have just tried to update an example multiplatform project to 1.2.0-alpha01-dev741 and Kotlin 1.7.10 (1.7.0 is the same) from dev-731 and get the following error message when I build for iOS
    java.lang.IllegalStateException: IrBasedSimpleFunctionDescriptor: FUN name:DataTooltipArea visibility:public modality:FINAL <> (dataString:kotlin.String, modifier:androidx.compose.ui.Modifier, content:kotlin.Function2<androidx.compose.runtime.Composer, kotlin.Int, kotlin.Unit>) returnType:kotlin.Unit [expect]
    The project builds and runs perfectly on JVM and even on Web (Canvas). Can anybody tell me what this error message actually means?
    m
    • 2
    • 1
  • s

    Sean Proctor

    07/10/2022, 12:35 AM
    I would like to use fonts from AWT in Compose. Is this possible? My goal is to allow users to select between some fonts. Are downloadable fonts supported in Compose for Desktop?
  • c

    Christopher Porto

    07/10/2022, 3:35 AM
    Is it possible to use LWJGL 3 AWT within Compose? My current attempt results in
    No context is current or a function that is not available in the current context was called. The JVM will abort execution.
    I'm sure this is due to some threading done underneath and was wondering if there was a way around it. I'll post code in thread. I'm not tied to using LWJGL or AWT, I simply wish to utilize OpenGL within Compose 🙂
    m
    • 2
    • 3
  • m

    Mikołaj Kąkol

    07/10/2022, 8:33 PM
    hello, is it possible to create Linux only compose application that would include a Kotlin Native library that would handle communication via USB (or similar low level api)?
    b
    c
    d
    • 4
    • 8
  • s

    Sean Proctor

    07/11/2022, 3:43 PM
    Is there any update on the simplified proguard integration? I just added the extended material icons for one or two of them. I don't really care that much about the resulting package size. It looks like 28 MB for those icons.
    g
    • 2
    • 1
  • n

    Norbi

    07/11/2022, 3:52 PM
    Hello, Do you have any info or experience about the current status of "gestures" support in Compose/Desktop? https://developer.android.com/jetpack/compose/gestures#multitouch
    e
    g
    d
    • 4
    • 5
  • s

    Scott Martin

    07/11/2022, 6:44 PM
    I'm not very familiar with windows anymore. is there a way to have a CfD app always run with administrator privileges?
    e
    • 2
    • 3
  • d

    dimsuz

    07/12/2022, 2:11 PM
    Hi! When looking at github releases page or source code, is there a quick way to check which compose version is used by jb-compose?
    l
    • 2
    • 4
  • l

    Lucas

    07/12/2022, 7:23 PM
    Whats the easiest workaround to using ScrollBar on a multiplatform project?
    m
    • 2
    • 3
  • a

    Arkadii Ivanov

    07/13/2022, 6:22 PM
    Both latest versions
    v1.2.0-alpha01-dev741
    and
    v1.2.0-alpha01-dev745
    compile just fine with Kotlin 1.7.10. Did anything change recently? I thought we would have to wait for a release compatible with Kotlin 1.7.10.
    l
    s
    +5
    • 8
    • 25
  • k

    K J

    07/13/2022, 8:27 PM
    How would I make it so that I have a box that responds to pointer inputs (custom dragging), but then inside of that box there is a smaller box which should not respond to dragging anymore? I'm unsure of how to stop the pointer input from cascading down to child elements. I'd like a box to be draggable but not allow the custom buttons inside it to be draggable.
  • l

    Lucas

    07/14/2022, 1:41 AM
    Any tips on how to bring my application to foreground if the user tries to open it when its already running? Just like Toolbox does
  • a

    Adam Brown

    07/14/2022, 6:21 AM
    Anyone else get this? It compiles just fine and runs, but the IDE doesn't seem to know about
    AlertDialog
    d
    • 2
    • 6
  • l

    Lucas

    07/14/2022, 1:29 PM
    Can i minimize a
    ComposeDialog
    ?
    d
    • 2
    • 4
  • f

    Francesco Pedron

    07/14/2022, 4:44 PM
    Hi, today I tried to run "packageMsi" gradle task on my compose-desktop project but I got this error:
    Cannot expand ZIP 'C:\Users\User\Documents\project_dir\build\wixToolset\wix311.zip' as it is not a file.
    In fact "wix311.zip" is not a file, but a directory that contains a "wix311-binaries.zip" file. I checked online but I haven't found any reference to this bug. Do you have any idea if it is a known issue and how may I resolve it? Let me know if there's any information I can provide, thanks. This is the gradle output just before the mentioned error message is printed:
    18:35:25: Executing 'packageMsi'...
    
    
    > Task :downloadWix
    Download <https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311-binaries.zip>
    Download <https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311-binaries.zip>
    
    > Task :unzipWix FAILED
    l
    • 2
    • 4
  • a

    Adam Brown

    07/14/2022, 11:53 PM
    whats everyone using for multipaltform localization? I'm seeing solutions for ios & Android, but not ones that also incorporate desktop support
    s
    m
    s
    • 4
    • 9
  • o

    orangy

    07/15/2022, 8:28 AM
    I wonder if there is a checklist somewhere for a reusable desktop component to check against. Like, accessibility, focus, RTL, etc. If anyone has their own, can you share it maybe?
    j
    • 2
    • 5
  • g

    Guilherme Delgado

    07/15/2022, 10:02 AM
    I’ve google sign in working on Android, iOS and Web, and I was wondering, how can i use it too in a compose desktop app? 🤔 Do i need a “webview” and then intercept an “OK response”, close it and proceed with “app logic”? Anyone tried it? Thanks! 🙌
    s
    • 2
    • 2
  • e

    elihart

    07/15/2022, 9:34 PM
    We’re using compose desktop within an Intellij IDE Plugin. It was working great up until recently but it seems like with Intelij 2022.1 (Android Studio Electric Eel build specifically) it just stopped working. Initial drawing works, but then recomposition just doesn’t seem to happen. Click and key press callbacks happen, but updating State doesn’t trigger recomposition, and things like mouse over highlights for standard components don’t show. It’s really bizarre, and I don’t see any errors in logs to point out what is going on. Debugging doesn’t give me any hints either. Anyone in a similar position?
    👀 2
    c
    c
    • 3
    • 6
  • g

    Guilherme Delgado

    07/17/2022, 4:10 PM
    In you documentation about deeplinks you have a sample showing how to do it in macOS. Tested and works perfectly, but how about
    windows
    and
    linux
    configuration/sample, did I miss it? 🤔
    ➕ 3
  • m

    mbonnin

    07/18/2022, 11:57 AM
    Anyone tried to use the Compose Desktop notarization helpers for a plain CLI app? Any chance I can reuse some of it?
  • d

    Didier Villevalois

    07/18/2022, 2:02 PM
    Hi all! In the Swing Interoperability examples (https://github.com/JetBrains/compose-jb/tree/master/tutorials/Window_API_new#swing-interoperability), it is shown how to open an AWT file dialog. I see that there is a
    window
    in the
    FrameWindowScope
    of the
    Window
    composable, but is there a corresponding ambient?
    k
    • 2
    • 4
  • e

    Emmanuel

    07/18/2022, 5:04 PM
    Code Review:
    fun onRefreshTrackCollection() {
        val job = scope.launch {
            refreshTrackCollection()
        }
        when(job.isCompleted) {
            // show snackbar message
        }
    }
    How do I better execute a UI change when a coroutine job is complete?
    l
    • 2
    • 4
  • j

    Jose Luis Torres Aguilar

    07/18/2022, 8:32 PM
    Hey guys does anyone knows a library for drag and drop files for desktop compose?
    👂 1
  • c

    Cyril Kym

    07/19/2022, 11:05 AM
    Hey Eveybody, is there a way to prevent the default behaviour of key events on an BasicTextField? Im currently reacting to a KeyDown Event on
    Key.Enter
    by using the
    onPreviewKeyEvent
    Modifier and I do not want the
    BasicTextField
    to unfocus when Enter is pressed. I was searching for a solution like preventDefault in JS but couldn't find anything so far.
    j
    • 2
    • 1
  • g

    Guilherme Delgado

    07/19/2022, 11:55 AM
    Hello! I’m trying
    1.2.0-alpha01-dev741
    and I’m having problems importing androidx.compose.foundation.lazy.grid. With version 1.0.1 I was using*:*
    import androidx.compose.foundation.lazy.GridCells
    import androidx.compose.foundation.lazy.LazyVerticalGrid
    Now, with version 1.2.0-alpha01-dev741 I have to change to:
    import androidx.compose.foundation.lazy.grid.LazyVerticalGrid
    import androidx.compose.foundation.lazy.grid.GridCells
    Otherwise the IDE throws an error. Up on changing the IDE doesn’t complain and finds the classes, but when I try to build I get the following:
    > Task :shared-ui-compose:compileDebugKotlinAndroid FAILED
    Unresolved reference: grid
    Unresolved reference: grid
    Unresolved reference: LazyVerticalGrid
    Unresolved reference: GridCells
    Unresolved reference: item
    @Composable invocations can only happen from the context of a @Composable function
    @Composable invocations can only happen from the context of a @Composable function
    What’s missing? 🤔
  • j

    Javier

    07/19/2022, 1:35 PM
    Upgrading to
    1.2.0-alpha01-dev748
    is failing with
    This version (1.2.0) of the Compose Compiler requires Kotlin version 1.7.0 but you appear to be using Kotlin version 1.7.10 which is not known to be compatible.  Please fix your configuration (or `suppressKotlinVersionCompatibilityCheck` but don't say I didn't warn you!).
    Meanwhile
    1.2.0-alpha01-dev745
    is working correctly 🤔
    a
    k
    j
    • 4
    • 31
  • o

    orangy

    07/19/2022, 4:10 PM
    Question to Google: is it possible to make
    :compose:ui:ui-tooling-data
    available for desktop? I’m experimenting with some tooling (kinda in-app inspector), and would like to process
    CompositionData
    , and it seems doing it via
    SlotTree
    is the best way of doing so.
    j
    • 2
    • 14
  • g

    Guilherme Delgado

    07/20/2022, 10:12 AM
    Is it possible to animate Window/WindowState size? I’ve tried the following (code in thread):
    s
    • 2
    • 11
Powered by Linen
Title
g

Guilherme Delgado

07/20/2022, 10:12 AM
Is it possible to animate Window/WindowState size? I’ve tried the following (code in thread):
fun main() = application {
    var expand by remember { mutableStateOf(false) }
    val width: Dp by animateDpAsState(
        targetValue = if (expand) 1024.dp else 600.dp,
        animationSpec = tween(durationMillis = 250, easing = FastOutSlowInEasing),
    )
    val height: Dp by animateDpAsState(
        targetValue = if (expand) 1024.dp else 600.dp,
        animationSpec = tween(durationMillis = 250, easing = FastOutSlowInEasing),
    )
    val dpSize: DpSize by remember { mutableStateOf(DpSize(width, height)) }
    val windowState = rememberWindowState(size = dpSize)

    Window(state = windowState) {
            MyComposable(
                onSomething = {
                    expand = !expand
                    //windowState.size = dpSize
                })
    }
}
To make it work I’ve to change the size here:
//windowState.size = dpSize
directly, but this will not animate 🤔
I’m lost, any hint?
s

Sean Proctor

07/24/2022, 8:08 PM
Did you figure this out? I think you want to do the
windowState.size = dpSize
immediately after
val windowState = ...
It might be better to update the size in a launched effect:
LaunchedEffect(dpSize) {
    windowState.size = dpSize
}
g

Guilherme Delgado

07/25/2022, 9:12 AM
I did not 😞 and the
onSomething
- in this case - it’s actually being called inside a
LaunchedEffect
, but the key is not the dpSize 🤔 will try to add it as key to see what happens (edit: nothing 😢).
I think the animations for some reason are not running/changing the window state. The same code animates a “normal” composable 🤷
LaunchedEffect(animate) {
    repeat(5) {
        delay(1000)
        windowState.size = DpSize(windowState.size.width + 100.dp, windowState.size.height)
    }
}
quick test and this is the only way I can “animate” the
windowState.size
🤮
@Sean Proctor maybe this is why:
/**
 * Creates a [WindowState] that is remembered across compositions.
 *
 * Changes to the provided initial values will **not** result in the state being recreated or
 * changed in any way if it has already been created.
 *
 * @param placement the initial value for [WindowState.placement]
 * @param isMinimized the initial value for [WindowState.isMinimized]
 * @param position the initial value for [WindowState.position]
 * @param size the initial value for [WindowState.size]
 */
🤔
s

Sean Proctor

07/27/2022, 11:28 PM
That makes sense. The window isn't a normal composable, so state hoisting won't work. I'm not very fluent with the animation APIs, so maybe there's something that looks a bit more elegant than what you have, but what you have is pretty close to what I was thinking. How does the animation itself look with that code? Maybe if you decrease the delay to something like 20ms or so it would look nicer?
g

Guilherme Delgado

07/28/2022, 9:26 AM
It doesn’t feel smooth and pretty like animation API, specially because I was thinking about using spring() or something non linear, but well, it does the job considering all constraints.
View count: 8