Skip to content

Commit

Permalink
Remove unused local window
Browse files Browse the repository at this point in the history
  • Loading branch information
devkanro committed Oct 12, 2023
1 parent e1f7b18 commit f17badb
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,6 @@ import java.awt.event.ComponentEvent
import java.awt.event.ComponentListener
import java.awt.event.WindowAdapter
import java.awt.event.WindowEvent
import javax.swing.JFrame

@Composable fun DecoratedWindow(
onCloseRequest: () -> Unit,
Expand All @@ -60,8 +59,7 @@ import javax.swing.JFrame
remember {
if (!JBR.isAvailable()) {
error(
"DecoratedWindow only can be used on JetBrainsRuntime(JBR) platform, " +
"please check the document https://github.com/JetBrains/jewel#int-ui-standalone-theme",
"DecoratedWindow only can be used on JetBrainsRuntime(JBR) platform, " + "please check the document https://github.com/JetBrains/jewel#int-ui-standalone-theme",
)
}
}
Expand Down Expand Up @@ -146,7 +144,6 @@ import javax.swing.JFrame
}

CompositionLocalProvider(
LocalWindow provides window,
LocalTitleBarInfo provides TitleBarInfo(title, icon),
) {
Layout({
Expand Down Expand Up @@ -213,8 +210,7 @@ private object DecoratedWindowMeasurePolicy : MeasurePolicy {
}
}

@Immutable @JvmInline
value class DecoratedWindowState(val state: ULong) {
@Immutable @JvmInline value class DecoratedWindowState(val state: ULong) {

@Stable val isActive: Boolean
get() = state and Active != 0UL
Expand Down Expand Up @@ -255,10 +251,7 @@ value class DecoratedWindowState(val state: ULong) {
maximized: Boolean = false,
active: Boolean = true,
) = DecoratedWindowState(
state = (if (fullscreen) Fullscreen else 0UL) or
(if (minimized) Minimize else 0UL) or
(if (maximized) Maximize else 0UL) or
(if (active) Active else 0UL),
state = (if (fullscreen) Fullscreen else 0UL) or (if (minimized) Minimize else 0UL) or (if (maximized) Maximize else 0UL) or (if (active) Active else 0UL),
)

fun of(
Expand All @@ -280,7 +273,3 @@ internal data class TitleBarInfo(
internal val LocalTitleBarInfo = compositionLocalOf<TitleBarInfo> {
error("CompositionLocal LocalTitleBarInfo not provided, TitleBar must be used in DecoratedWindow")
}

val LocalWindow = compositionLocalOf<JFrame> {
error("CompositionLocal LocalWindow not provided")
}
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ internal const val TITLE_BAR_BORDER_LAYOUT_ID = "__TITLE_BAR_BORDER__"
}
}.fillMaxWidth(),
measurePolicy = rememberTitleBarMeasurePolicy(
LocalWindow.current,
window,
state,
applyTitleBar,
),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private fun TabStripWithAddButton(
.background(backgroundColor),
contentAlignment = Alignment.Center,
) {
val addIconProvider = remember { ResourcePainterProvider.stateless("icons/intui/add.svg", svgLoader) }
val addIconProvider = remember { ResourcePainterProvider.stateless("expui/general/add.svg", svgLoader) }
val addIcon by addIconProvider.getPainter(resourceLoader)

Icon(addIcon, contentDescription = "Add a tab")
Expand Down

0 comments on commit f17badb

Please sign in to comment.