mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-03-22 15:19:59 +07:00
[jewel] Bugfix decorated window on windows
Reference https://github.com/JetBrains/jewel/pull/731 closes https://github.com/JetBrains/intellij-community/pull/2920 (cherry picked from commit 61be2b8b30ef3417937e0966b7f2e2d5082542ed) (cherry picked from commit 97ce6439aa53ec5c13241e3607508ab8b378929d) IJ-MR-155570 GitOrigin-RevId: 1f8fdb352c6cbac72d7e22fd9e4ce8624ee5281d
This commit is contained in:
committed by
intellij-monorepo-bot
parent
5cf89a0521
commit
34b7062948
@@ -35,6 +35,10 @@ com.jetbrains.WindowDecorations$CustomTitleBar
|
||||
- a:setHeight(F):V
|
||||
com.jetbrains.WindowMove
|
||||
- a:startMovingTogetherWithMouse(java.awt.Window,I):V
|
||||
f:org.jetbrains.jewel.window.ComposableSingletons$TitleBarKt
|
||||
- sf:INSTANCE:org.jetbrains.jewel.window.ComposableSingletons$TitleBarKt
|
||||
- <init>():V
|
||||
- f:getLambda-1$intellij_platform_jewel_decoratedWindow():kotlin.jvm.functions.Function2
|
||||
f:org.jetbrains.jewel.window.DecoratedWindowKt
|
||||
- sf:DecoratedWindow(kotlin.jvm.functions.Function0,androidx.compose.ui.window.WindowState,Z,java.lang.String,androidx.compose.ui.graphics.painter.Painter,Z,Z,Z,Z,kotlin.jvm.functions.Function1,kotlin.jvm.functions.Function1,org.jetbrains.jewel.window.styling.DecoratedWindowStyle,kotlin.jvm.functions.Function3,androidx.compose.runtime.Composer,I,I,I):V
|
||||
org.jetbrains.jewel.window.DecoratedWindowScope
|
||||
|
||||
@@ -49,6 +49,13 @@ public abstract interface class com/jetbrains/WindowMove {
|
||||
public abstract fun startMovingTogetherWithMouse (Ljava/awt/Window;I)V
|
||||
}
|
||||
|
||||
public final class org/jetbrains/jewel/window/ComposableSingletons$TitleBarKt {
|
||||
public static final field INSTANCE Lorg/jetbrains/jewel/window/ComposableSingletons$TitleBarKt;
|
||||
public static field lambda-1 Lkotlin/jvm/functions/Function2;
|
||||
public fun <init> ()V
|
||||
public final fun getLambda-1$decorated_window ()Lkotlin/jvm/functions/Function2;
|
||||
}
|
||||
|
||||
public final class org/jetbrains/jewel/window/DecoratedWindowKt {
|
||||
public static final fun DecoratedWindow (Lkotlin/jvm/functions/Function0;Landroidx/compose/ui/window/WindowState;ZLjava/lang/String;Landroidx/compose/ui/graphics/painter/Painter;ZZZZLkotlin/jvm/functions/Function1;Lkotlin/jvm/functions/Function1;Lorg/jetbrains/jewel/window/styling/DecoratedWindowStyle;Lkotlin/jvm/functions/Function3;Landroidx/compose/runtime/Composer;III)V
|
||||
}
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
package org.jetbrains.jewel.window
|
||||
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.runtime.Composable
|
||||
import androidx.compose.runtime.remember
|
||||
import androidx.compose.ui.Modifier
|
||||
@@ -27,7 +29,7 @@ internal fun DecoratedWindowScope.TitleBarOnWindows(
|
||||
val titleBar = remember { JBR.getWindowDecorations().createCustomTitleBar() }
|
||||
|
||||
TitleBarImpl(
|
||||
modifier = modifier.customTitleBarMouseEventHandler(titleBar),
|
||||
modifier = modifier,
|
||||
gradientStartColor = gradientStartColor,
|
||||
style = style,
|
||||
applyTitleBar = { height, _ ->
|
||||
@@ -36,6 +38,7 @@ internal fun DecoratedWindowScope.TitleBarOnWindows(
|
||||
JBR.getWindowDecorations().setCustomTitleBar(window, titleBar)
|
||||
PaddingValues(start = titleBar.leftInset.dp, end = titleBar.rightInset.dp)
|
||||
},
|
||||
backgroundContent = { Spacer(modifier = modifier.fillMaxSize().customTitleBarMouseEventHandler(titleBar)) },
|
||||
content = content,
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package org.jetbrains.jewel.window
|
||||
|
||||
import androidx.compose.foundation.background
|
||||
import androidx.compose.foundation.layout.Box
|
||||
import androidx.compose.foundation.layout.PaddingValues
|
||||
import androidx.compose.foundation.layout.Spacer
|
||||
import androidx.compose.foundation.layout.fillMaxSize
|
||||
import androidx.compose.foundation.layout.fillMaxWidth
|
||||
import androidx.compose.foundation.layout.height
|
||||
import androidx.compose.runtime.Composable
|
||||
@@ -77,6 +79,7 @@ internal fun DecoratedWindowScope.TitleBarImpl(
|
||||
gradientStartColor: Color = Color.Unspecified,
|
||||
style: TitleBarStyle = JewelTheme.defaultTitleBarStyle,
|
||||
applyTitleBar: (Dp, DecoratedWindowState) -> PaddingValues,
|
||||
backgroundContent: @Composable () -> Unit = {},
|
||||
content: @Composable TitleBarScope.(DecoratedWindowState) -> Unit,
|
||||
) {
|
||||
val titleBarInfo = LocalTitleBarInfo.current
|
||||
@@ -102,19 +105,7 @@ internal fun DecoratedWindowScope.TitleBarImpl(
|
||||
}
|
||||
}
|
||||
|
||||
Layout(
|
||||
content = {
|
||||
CompositionLocalProvider(
|
||||
LocalContentColor provides style.colors.content,
|
||||
LocalIconButtonStyle provides style.iconButtonStyle,
|
||||
LocalDefaultDropdownStyle provides style.dropdownStyle,
|
||||
) {
|
||||
OverrideDarkMode(background.isDark()) {
|
||||
val scope = TitleBarScopeImpl(titleBarInfo.title, titleBarInfo.icon)
|
||||
scope.content(state)
|
||||
}
|
||||
}
|
||||
},
|
||||
Box(
|
||||
modifier =
|
||||
modifier
|
||||
.background(backgroundBrush)
|
||||
@@ -122,9 +113,26 @@ internal fun DecoratedWindowScope.TitleBarImpl(
|
||||
.layoutId(TITLE_BAR_LAYOUT_ID)
|
||||
.height(style.metrics.height)
|
||||
.onSizeChanged { with(density) { applyTitleBar(it.height.toDp(), state) } }
|
||||
.fillMaxWidth(),
|
||||
measurePolicy = rememberTitleBarMeasurePolicy(window, state, applyTitleBar),
|
||||
)
|
||||
.fillMaxWidth()
|
||||
) {
|
||||
backgroundContent()
|
||||
Layout(
|
||||
content = {
|
||||
CompositionLocalProvider(
|
||||
LocalContentColor provides style.colors.content,
|
||||
LocalIconButtonStyle provides style.iconButtonStyle,
|
||||
LocalDefaultDropdownStyle provides style.dropdownStyle,
|
||||
) {
|
||||
OverrideDarkMode(background.isDark()) {
|
||||
val scope = TitleBarScopeImpl(titleBarInfo.title, titleBarInfo.icon)
|
||||
scope.content(state)
|
||||
}
|
||||
}
|
||||
},
|
||||
modifier = modifier.fillMaxSize(),
|
||||
measurePolicy = rememberTitleBarMeasurePolicy(window, state, applyTitleBar),
|
||||
)
|
||||
}
|
||||
|
||||
Spacer(Modifier.layoutId(TITLE_BAR_BORDER_LAYOUT_ID).height(1.dp).fillMaxWidth().background(style.colors.border))
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user