Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When the window width is adjusted, the width of the Button component also scales along with the container. #4521

Closed
uiexp opened this issue Mar 21, 2024 · 6 comments
Assignees
Labels

Comments

@uiexp
Copy link

uiexp commented Mar 21, 2024

Describe the bug
When the window width is adjusted, the width of the Button component also scales along with the container.

Affected platforms

  • Desktop (Windows)

Versions

  • Kotlin version*: 1.9.23
  • Compose Multiplatform version*: 1.6.1
  • OS version(s)* (required for Desktop and iOS issues): windows10
  • OS architecture (x86 or arm64): x86
  • Device (model or simulator for iOS issues): pc
  • JDK (for desktop issues): 17.0.9

To Reproduce
Steps and/or the code snippet to reproduce the behavior:

fun main() = application {
    Window(
        onCloseRequest = ::exitApplication, title = "MultiDesk"
    ) {

        MaterialTheme {
            Surface(color = MaterialTheme.colors.background) {
                Row {
                    Button(onClick = {}) {
                        Text("test")
                    }
                    Button(onClick = {}) {
                        Text("test")
                    }
                }
            }

        }

    }
}

Adjust window width after running

@uiexp uiexp added bug Something isn't working submitted labels Mar 21, 2024
@pjBooms pjBooms removed the submitted label Mar 21, 2024
@m-sasha
Copy link
Contributor

m-sasha commented Mar 21, 2024

Could you provide a screen recording and the full source code (include imports)? This doesn't reproduce on my Mac, but there's nothing here that is OS-specific.

Screen.Recording.2024-03-21.at.11.37.32.mp4

@m-sasha m-sasha added the wait for reply Further information is requested label Mar 21, 2024
@uiexp
Copy link
Author

uiexp commented Mar 22, 2024

I'm running on Windows 10. This is a video recording. I'll test on Mac later.

libs.versions.toml
[versions]
compose = "1.6.2"
compose-plugin = "1.6.1"
junit = "4.13.2"
kotlin = "1.9.23"

VID_20240322_115405.mp4

@changhexuefei
Copy link

The following is the performance of the above code on Windows 11.

20240322_172837.mp4

@m-sasha
Copy link
Contributor

m-sasha commented Mar 22, 2024

This is a problem at the level of skiko and seems to be the result of how we tell Windows to scale the contents of the window until we update the picture here.

There's no easy fix for this. We could tell Windows not to stretch the picture, but then you'd probably see black bars when resizing. The real fix would be to make sure we update the picture before the next screen refresh.

@m-sasha m-sasha added windows reproduced and removed wait for reply Further information is requested labels Mar 22, 2024
@uiexp
Copy link
Author

uiexp commented Mar 25, 2024

This is a problem at the level of skiko and seems to be the result of how we tell Windows to scale the contents of the window until we update the picture here.

There's no easy fix for this. We could tell Windows not to stretch the picture, but then you'd probably see black bars when resizing. The real fix would be to make sure we update the picture before the next screen refresh.

Thank you for your answer. I hope it can be optimized!

@MatkovIvan
Copy link
Member

Found issues about "black bars" instead of streaching - #2925
It's essentially the same, so let's track it there

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants