mirror of
https://github.com/simplex-chat/simplex-chat.git
synced 2025-06-29 04:39:53 +00:00
desktop: correct height of a window (#3982)
This commit is contained in:
parent
b8ee2af5b7
commit
28fbc1cd84
1 changed files with 11 additions and 8 deletions
|
@ -7,6 +7,8 @@ import androidx.compose.ui.Modifier
|
||||||
import androidx.compose.ui.platform.LocalDensity
|
import androidx.compose.ui.platform.LocalDensity
|
||||||
import androidx.compose.ui.unit.Dp
|
import androidx.compose.ui.unit.Dp
|
||||||
import chat.simplex.common.platform.*
|
import chat.simplex.common.platform.*
|
||||||
|
import chat.simplex.common.simplexWindowState
|
||||||
|
import java.awt.Window
|
||||||
|
|
||||||
@Composable
|
@Composable
|
||||||
actual fun PlayerView(player: VideoPlayer, width: Dp, onClick: () -> Unit, onLongClick: () -> Unit, stop: () -> Unit) {
|
actual fun PlayerView(player: VideoPlayer, width: Dp, onClick: () -> Unit, onLongClick: () -> Unit, stop: () -> Unit) {
|
||||||
|
@ -23,14 +25,15 @@ actual fun PlayerView(player: VideoPlayer, width: Dp, onClick: () -> Unit, onLon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
* This function doesn't take into account multi-window environment. In case more windows will be used, modify the code
|
||||||
|
* */
|
||||||
@Composable
|
@Composable
|
||||||
actual fun LocalWindowWidth(): Dp {
|
actual fun LocalWindowWidth(): Dp = with(LocalDensity.current) {
|
||||||
return with(LocalDensity.current) { (java.awt.Window.getWindows().find { it.isActive }?.width ?: 0).toDp() }
|
val windows = java.awt.Window.getWindows()
|
||||||
/*val density = LocalDensity.current
|
if (windows.size == 1) {
|
||||||
var width by remember { mutableStateOf(with(density) { (java.awt.Window.getWindows().find { it.isActive }?.width ?: 0).toDp() }) }
|
(windows.getOrNull(0)?.width ?: 0).toDp()
|
||||||
SideEffect {
|
} else {
|
||||||
if (width != with(density) { (java.awt.Window.getWindows().find { it.isActive }?.width ?: 0).toDp() })
|
simplexWindowState.windowState.size.width
|
||||||
width = with(density) { (java.awt.Window.getWindows().find { it.isActive }?.width ?: 0).toDp() }
|
|
||||||
}
|
}
|
||||||
return width.also { println("LALAL $it") }*/
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue