[JEWEL-963] Folding int-ui-decorated-window and decorated-window modules

- Moved all code and resources to decorated-window module
- Updated maven artifacts publisher
- Removed duplicated classes from JBR-Api and started using the official lib instead
- Updated API Dumps

closes https://github.com/JetBrains/intellij-community/pull/3175

(cherry picked from commit 38625f63c8731753a0b5ca9fd855de7532a961cc)

# Conflicts:
#	build/bazel-targets.json

# Conflicts:
#	build/bazel-targets.json


(cherry picked from commit f9b4e8b7de4e85f7bb52563f2f05471ba940db86)

IJ-MR-173046

GitOrigin-RevId: eaddfad6e03b3dd2450443b2bcef9f0f6c76f556
This commit is contained in:
Gustavo Fao Valvassori
2025-08-11 13:20:30 +02:00
committed by intellij-monorepo-bot
parent 16982b2f82
commit 8060fcc9cd
39 changed files with 56 additions and 610 deletions

View File

@@ -41,7 +41,7 @@ internal object JewelMavenArtifacts {
private val transitiveJewelDependencies = mapOf(
"jewel-foundation" to emptySet(),
"jewel-ui" to emptySet(),
"jewel-decorated-window" to setOf("jewel-foundation"),
"jewel-decorated-window" to setOf("jewel-foundation", "jewel-ui"),
"jewel-markdown-core" to setOf("jewel-foundation"),
"jewel-markdown-extensions-autolink" to setOf("jewel-foundation", "jewel-ui"),
"jewel-markdown-extensions-gfm-alerts" to setOf("jewel-foundation", "jewel-ui"),

View File

@@ -23,7 +23,7 @@ jvm_library(
name = "decorated-window",
module_name = "intellij.platform.jewel.decoratedWindow",
visibility = ["//visibility:public"],
srcs = glob(["src/main/kotlin/**/*.kt", "src/main/kotlin/**/*.java", "src/main/java/**/*.kt", "src/main/java/**/*.java"], allow_empty = True),
srcs = glob(["src/main/kotlin/**/*.kt", "src/main/kotlin/**/*.java"], allow_empty = True),
kotlinc_opts = ":custom",
deps = [
"@lib//:kotlin-stdlib",
@@ -32,9 +32,15 @@ jvm_library(
"//platform/jewel/ui",
"//libraries/compose-foundation-desktop",
"//platform/jewel/foundation",
"//platform/jewel/int-ui/int-ui-standalone:jewel-intUi-standalone",
"@lib//:jna",
"@lib//:jbr-api",
],
exports = [
"//platform/jewel/int-ui/int-ui-standalone:jewel-intUi-standalone",
"@lib//:jbr-api",
],
runtime_deps = [":decorated-window_resources"],
plugins = ["@lib//:compose-plugin"]
)
### auto-generated section `build intellij.platform.jewel.decoratedWindow` end
### auto-generated section `build intellij.platform.jewel.decoratedWindow` end

View File

@@ -1,40 +1,37 @@
com.jetbrains.DesktopActions
- a:setHandler(com.jetbrains.DesktopActions$Handler):V
com.jetbrains.DesktopActions$Handler
- browse(java.net.URI):V
- edit(java.io.File):V
- mail(java.net.URI):V
- open(java.io.File):V
- print(java.io.File):V
f:com.jetbrains.JBR
- s:getApiVersion():java.lang.String
- s:getDesktopActions():com.jetbrains.DesktopActions
- s:getRoundedCornersManager():com.jetbrains.RoundedCornersManager
- s:getWindowDecorations():com.jetbrains.WindowDecorations
- s:getWindowMove():com.jetbrains.WindowMove
- s:isAvailable():Z
- s:isDesktopActionsSupported():Z
- s:isRoundedCornersManagerSupported():Z
- s:isWindowDecorationsSupported():Z
- s:isWindowMoveSupported():Z
com.jetbrains.RoundedCornersManager
- a:setRoundedCorners(java.awt.Window,java.lang.Object):V
com.jetbrains.WindowDecorations
- a:createCustomTitleBar():com.jetbrains.WindowDecorations$CustomTitleBar
- a:setCustomTitleBar(java.awt.Dialog,com.jetbrains.WindowDecorations$CustomTitleBar):V
- a:setCustomTitleBar(java.awt.Frame,com.jetbrains.WindowDecorations$CustomTitleBar):V
com.jetbrains.WindowDecorations$CustomTitleBar
- a:forceHitTest(Z):V
- a:getContainingWindow():java.awt.Window
- a:getHeight():F
- a:getLeftInset():F
- a:getProperties():java.util.Map
- a:getRightInset():F
- a:putProperties(java.util.Map):V
- a:putProperty(java.lang.String,java.lang.Object):V
- a:setHeight(F):V
com.jetbrains.WindowMove
- a:startMovingTogetherWithMouse(java.awt.Window,I):V
f:org.jetbrains.jewel.intui.window.DecoratedWindowIconKeys
- sf:$stable:I
- sf:INSTANCE:org.jetbrains.jewel.intui.window.DecoratedWindowIconKeys
- f:getClose():org.jetbrains.jewel.ui.icon.IconKey
- f:getMaximize():org.jetbrains.jewel.ui.icon.IconKey
- f:getMinimize():org.jetbrains.jewel.ui.icon.IconKey
- f:getRestore():org.jetbrains.jewel.ui.icon.IconKey
f:org.jetbrains.jewel.intui.window.IntUiDecoratedWindowResourceResolverKt
- sf:decoratedWindowPainterProvider(java.lang.String):org.jetbrains.jewel.ui.painter.ResourcePainterProvider
f:org.jetbrains.jewel.intui.window.IntUiThemeKt
- sf:decoratedWindow(org.jetbrains.jewel.ui.ComponentStyling,org.jetbrains.jewel.window.styling.DecoratedWindowStyle,org.jetbrains.jewel.window.styling.TitleBarStyle):org.jetbrains.jewel.ui.ComponentStyling
- bs:decoratedWindow$default(org.jetbrains.jewel.ui.ComponentStyling,org.jetbrains.jewel.window.styling.DecoratedWindowStyle,org.jetbrains.jewel.window.styling.TitleBarStyle,I,java.lang.Object):org.jetbrains.jewel.ui.ComponentStyling
f:org.jetbrains.jewel.intui.window.styling.IntUiDecoratedWindowStylingKt
- sf:dark(org.jetbrains.jewel.window.styling.DecoratedWindowStyle$Companion,org.jetbrains.jewel.window.styling.DecoratedWindowColors,org.jetbrains.jewel.window.styling.DecoratedWindowMetrics):org.jetbrains.jewel.window.styling.DecoratedWindowStyle
- bs:dark$default(org.jetbrains.jewel.window.styling.DecoratedWindowStyle$Companion,org.jetbrains.jewel.window.styling.DecoratedWindowColors,org.jetbrains.jewel.window.styling.DecoratedWindowMetrics,I,java.lang.Object):org.jetbrains.jewel.window.styling.DecoratedWindowStyle
- sf:dark-WkMS-hQ(org.jetbrains.jewel.window.styling.DecoratedWindowColors$Companion,J,J):org.jetbrains.jewel.window.styling.DecoratedWindowColors
- bs:dark-WkMS-hQ$default(org.jetbrains.jewel.window.styling.DecoratedWindowColors$Companion,J,J,I,java.lang.Object):org.jetbrains.jewel.window.styling.DecoratedWindowColors
- sf:defaults-3ABfNKs(org.jetbrains.jewel.window.styling.DecoratedWindowMetrics$Companion,F):org.jetbrains.jewel.window.styling.DecoratedWindowMetrics
- bs:defaults-3ABfNKs$default(org.jetbrains.jewel.window.styling.DecoratedWindowMetrics$Companion,F,I,java.lang.Object):org.jetbrains.jewel.window.styling.DecoratedWindowMetrics
- sf:light(org.jetbrains.jewel.window.styling.DecoratedWindowStyle$Companion,org.jetbrains.jewel.window.styling.DecoratedWindowColors,org.jetbrains.jewel.window.styling.DecoratedWindowMetrics):org.jetbrains.jewel.window.styling.DecoratedWindowStyle
- bs:light$default(org.jetbrains.jewel.window.styling.DecoratedWindowStyle$Companion,org.jetbrains.jewel.window.styling.DecoratedWindowColors,org.jetbrains.jewel.window.styling.DecoratedWindowMetrics,I,java.lang.Object):org.jetbrains.jewel.window.styling.DecoratedWindowStyle
- sf:light-WkMS-hQ(org.jetbrains.jewel.window.styling.DecoratedWindowColors$Companion,J,J):org.jetbrains.jewel.window.styling.DecoratedWindowColors
- bs:light-WkMS-hQ$default(org.jetbrains.jewel.window.styling.DecoratedWindowColors$Companion,J,J,I,java.lang.Object):org.jetbrains.jewel.window.styling.DecoratedWindowColors
f:org.jetbrains.jewel.intui.window.styling.IntUiTitleBarStylingKt
- sf:dark(org.jetbrains.jewel.window.styling.TitleBarStyle$Companion,org.jetbrains.jewel.window.styling.TitleBarColors,org.jetbrains.jewel.window.styling.TitleBarMetrics,org.jetbrains.jewel.window.styling.TitleBarIcons,androidx.compose.runtime.Composer,I,I):org.jetbrains.jewel.window.styling.TitleBarStyle
- sf:dark-a6iJyiw(org.jetbrains.jewel.window.styling.TitleBarColors$Companion,J,J,J,J,J,J,J,J,J,J,J,J,J,androidx.compose.runtime.Composer,I,I,I):org.jetbrains.jewel.window.styling.TitleBarColors
- sf:defaults(org.jetbrains.jewel.window.styling.TitleBarIcons$Companion,org.jetbrains.jewel.ui.icon.IconKey,org.jetbrains.jewel.ui.icon.IconKey,org.jetbrains.jewel.ui.icon.IconKey,org.jetbrains.jewel.ui.icon.IconKey):org.jetbrains.jewel.window.styling.TitleBarIcons
- bs:defaults$default(org.jetbrains.jewel.window.styling.TitleBarIcons$Companion,org.jetbrains.jewel.ui.icon.IconKey,org.jetbrains.jewel.ui.icon.IconKey,org.jetbrains.jewel.ui.icon.IconKey,org.jetbrains.jewel.ui.icon.IconKey,I,java.lang.Object):org.jetbrains.jewel.window.styling.TitleBarIcons
- sf:defaults-LgNEgRQ(org.jetbrains.jewel.window.styling.TitleBarMetrics$Companion,F,F,F,J):org.jetbrains.jewel.window.styling.TitleBarMetrics
- bs:defaults-LgNEgRQ$default(org.jetbrains.jewel.window.styling.TitleBarMetrics$Companion,F,F,F,J,I,java.lang.Object):org.jetbrains.jewel.window.styling.TitleBarMetrics
- sf:light(org.jetbrains.jewel.window.styling.TitleBarStyle$Companion,org.jetbrains.jewel.window.styling.TitleBarColors,org.jetbrains.jewel.window.styling.TitleBarMetrics,org.jetbrains.jewel.window.styling.TitleBarIcons,androidx.compose.runtime.Composer,I,I):org.jetbrains.jewel.window.styling.TitleBarStyle
- sf:light-a6iJyiw(org.jetbrains.jewel.window.styling.TitleBarColors$Companion,J,J,J,J,J,J,J,J,J,J,J,J,J,androidx.compose.runtime.Composer,I,I,I):org.jetbrains.jewel.window.styling.TitleBarColors
- sf:lightWithLightHeader(org.jetbrains.jewel.window.styling.TitleBarStyle$Companion,org.jetbrains.jewel.window.styling.TitleBarColors,org.jetbrains.jewel.window.styling.TitleBarMetrics,org.jetbrains.jewel.window.styling.TitleBarIcons,androidx.compose.runtime.Composer,I,I):org.jetbrains.jewel.window.styling.TitleBarStyle
- sf:lightWithLightHeader-a6iJyiw(org.jetbrains.jewel.window.styling.TitleBarColors$Companion,J,J,J,J,J,J,J,J,J,J,J,J,J,androidx.compose.runtime.Composer,I,I,I):org.jetbrains.jewel.window.styling.TitleBarColors
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

View File

@@ -12,6 +12,7 @@ private val composeVersion
dependencies {
api("org.jetbrains.compose.foundation:foundation-desktop:$composeVersion")
api(projects.ui)
api(projects.intUi.intUiStandalone)
api(libs.jbr.api)
implementation(libs.jna.core)
}

View File

@@ -28,7 +28,6 @@
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/kotlin" isTestSource="false" />
<sourceFolder url="file://$MODULE_DIR$/src/main/java" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="library" name="kotlin-stdlib" level="project" />
@@ -38,6 +37,8 @@
<orderEntry type="module" module-name="intellij.platform.jewel.ui" />
<orderEntry type="module" module-name="intellij.libraries.compose.foundation.desktop" />
<orderEntry type="module" module-name="intellij.platform.jewel.foundation" />
<orderEntry type="module" module-name="intellij.platform.jewel.intUi.standalone" exported="" />
<orderEntry type="library" name="jna" level="project" />
<orderEntry type="library" exported="" name="jbr-api" level="project" />
</component>
</module>

View File

@@ -1,42 +0,0 @@
/*
* Copyright 2000-2022 JetBrains s.r.o.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.jetbrains;
import java.io.File;
import java.io.IOException;
import java.net.URI;
public interface DesktopActions {
void setHandler(Handler handler);
interface Handler {
default void open(File file) throws IOException { throw new UnsupportedOperationException(); }
default void edit(File file) throws IOException { throw new UnsupportedOperationException(); }
default void print(File file) throws IOException { throw new UnsupportedOperationException(); }
default void mail(URI mailtoURL) throws IOException { throw new UnsupportedOperationException(); }
default void browse(URI uri) throws IOException { throw new UnsupportedOperationException(); }
}
}

View File

@@ -1,197 +0,0 @@
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
package com.jetbrains;
import java.lang.invoke.MethodHandles;
import java.lang.reflect.InvocationTargetException;
/**
* This class is an entry point into JBR API.
* JBR API is a collection of services, classes, interfaces, etc.,
* which require tight interaction with JRE and therefore are implemented inside JBR.
* <div>JBR API consists of two parts:</div>
* <ul>
* <li>Client side - {@code jetbrains.api} module, mostly containing interfaces</li>
* <li>JBR side - actual implementation code inside JBR</li>
* </ul>
* Client and JBR side are linked dynamically at runtime and do not have to be of the same version.
* In some cases (e.g. running on different JRE or old JBR) system will not be able to find
* implementation for some services, so you'll need a fallback behavior for that case.
* <h2>Simple usage example:</h2>
* <blockquote><pre>{@code
* if (JBR.isSomeServiceSupported()) {
* JBR.getSomeService().doSomething();
* } else {
* planB();
* }
* }</pre></blockquote>
*
* @implNote JBR API is initialized on first access to this class (in static initializer).
* Actual implementation is linked on demand, when corresponding service is requested by client.
*/
public final class JBR {
private static final ServiceApi api;
private static final Exception bootstrapException;
static {
ServiceApi a = null;
Exception exception = null;
try {
a = (ServiceApi) Class.forName("com.jetbrains.bootstrap.JBRApiBootstrap")
.getMethod("bootstrap", MethodHandles.Lookup.class)
.invoke(null, MethodHandles.lookup());
} catch (InvocationTargetException e) {
Throwable t = e.getCause();
if (t instanceof Error error) throw error;
else throw new Error(t);
} catch (IllegalAccessException | NoSuchMethodException | ClassNotFoundException e) {
exception = e;
}
api = a;
bootstrapException = exception;
}
private JBR() {
}
private static <T> T getService(Class<T> interFace, FallbackSupplier<T> fallback) {
T service = getService(interFace);
try {
return service != null ? service : fallback != null ? fallback.get() : null;
} catch (Throwable ignore) {
return null;
}
}
static <T> T getService(Class<T> interFace) {
return api == null ? null : api.getService(interFace);
}
/**
* @return true when running on JBR which implements JBR API
*/
public static boolean isAvailable() {
return api != null;
}
/**
* @return JBR API version in form {@code JBR.MAJOR.MINOR.PATCH}
* @implNote This is an API version, which comes with client application,
* it has nothing to do with JRE it runs on.
*/
public static String getApiVersion() {
return "17.0.8.1b1070.2.1.9.0";
}
/**
* Internal API interface, contains most basic methods for communication between client and JBR.
*/
private interface ServiceApi {
<T> T getService(Class<T> interFace);
}
@FunctionalInterface
private interface FallbackSupplier<T> {
T get() throws Throwable;
}
// ========================== Generated metadata ==========================
/**
* Generated client-side metadata, needed by JBR when linking the implementation.
*/
private static final class Metadata {
private static final String[] KNOWN_SERVICES = {"com.jetbrains.ExtendedGlyphCache", "com.jetbrains.DesktopActions", "com.jetbrains.CustomWindowDecoration", "com.jetbrains.ProjectorUtils", "com.jetbrains.FontExtensions", "com.jetbrains.RoundedCornersManager", "com.jetbrains.GraphicsUtils", "com.jetbrains.WindowDecorations", "com.jetbrains.JBRFileDialogService", "com.jetbrains.AccessibleAnnouncer", "com.jetbrains.JBR$ServiceApi", "com.jetbrains.Jstack", "com.jetbrains.WindowMove"};
private static final String[] KNOWN_PROXIES = {"com.jetbrains.JBRFileDialog", "com.jetbrains.WindowDecorations$CustomTitleBar"};
}
// ======================= Generated static methods =======================
private static class DesktopActions__Holder {
private static final DesktopActions INSTANCE = getService(DesktopActions.class, null);
}
/**
* @return true if current runtime has implementation for all methods in {@link DesktopActions}
* and its dependencies (can fully implement given service).
* @see #getDesktopActions()
*/
public static boolean isDesktopActionsSupported() {
return DesktopActions__Holder.INSTANCE != null;
}
/**
* @return full implementation of {@link DesktopActions} service if any, or {@code null} otherwise
*/
public static DesktopActions getDesktopActions() {
return DesktopActions__Holder.INSTANCE;
}
private static class RoundedCornersManager__Holder {
private static final RoundedCornersManager INSTANCE = getService(RoundedCornersManager.class, null);
}
/**
* @return true if current runtime has implementation for all methods in {@link RoundedCornersManager}
* and its dependencies (can fully implement given service).
* @see #getRoundedCornersManager()
*/
public static boolean isRoundedCornersManagerSupported() {
return RoundedCornersManager__Holder.INSTANCE != null;
}
/**
* This manager allows decorate awt Window with rounded corners.
* Appearance depends from operating system.
*
* @return full implementation of {@link RoundedCornersManager} service if any, or {@code null} otherwise
*/
public static RoundedCornersManager getRoundedCornersManager() {
return RoundedCornersManager__Holder.INSTANCE;
}
private static class WindowDecorations__Holder {
private static final WindowDecorations INSTANCE = getService(WindowDecorations.class, null);
}
/**
* @return true if current runtime has implementation for all methods in {@link WindowDecorations}
* and its dependencies (can fully implement given service).
* @see #getWindowDecorations()
*/
public static boolean isWindowDecorationsSupported() {
return WindowDecorations__Holder.INSTANCE != null;
}
/**
* Window decorations consist of title bar, window controls and border.
*
* @return full implementation of {@link WindowDecorations} service if any, or {@code null} otherwise
* @see WindowDecorations.CustomTitleBar
*/
public static WindowDecorations getWindowDecorations() {
return WindowDecorations__Holder.INSTANCE;
}
private static class WindowMove__Holder {
private static final WindowMove INSTANCE = getService(WindowMove.class, null);
}
/**
* @return true if current runtime has implementation for all methods in {@link WindowMove}
* and its dependencies (can fully implement given service).
* @see #getWindowMove()
*/
public static boolean isWindowMoveSupported() {
return WindowMove__Holder.INSTANCE != null;
}
/**
* @return full implementation of {@link WindowMove} service if any, or {@code null} otherwise
*/
public static WindowMove getWindowMove() {
return WindowMove__Holder.INSTANCE;
}
}

View File

@@ -1,55 +0,0 @@
/*
* Copyright 2000-2023 JetBrains s.r.o.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.jetbrains;
import java.awt.*;
/**
* This manager allows decorated AWT Window with rounded corners.
* The appearance depends on the operating system.
*/
public interface RoundedCornersManager {
/**
* Sets rounded corners on the target {@link Window}.
*
* @param params For macOS, it is a {@code Float} object with the radius or an Array containing:
* <ul>
* <li>A {@code Float} for the radius</li>
* <li>An {@code Integer} for the border width</li>
* <li>A {@code java.awt.Color} for the border color</li>
* </ul>
* <br/>
* For Windows 11, it is a {@code String} with one of these values:
* <ul>
* <li>{@code "default"} — let the system decide whether to round window corners</li>
* <li>{@code "none"} — never round window corners</li>
* <li>{@code "full"} — round the corners if appropriate</li>
* <li>{@code "small"} — round the corners if appropriate, with a small radius</li>
* </ul>
* <br/>
*/
void setRoundedCorners(Window window, Object params);
}

View File

@@ -1,177 +0,0 @@
/*
* Copyright 2023 JetBrains s.r.o.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.jetbrains;
import java.awt.*;
import java.util.Map;
/**
* Window decorations consist of title bar, window controls and border.
* @see CustomTitleBar
*/
public interface WindowDecorations {
/**
* If {@code customTitleBar} is not null, system-provided title bar is removed and client area is extended to the
* top of the frame with window controls painted over the client area.
* {@code customTitleBar=null} resets to the default appearance with system-provided title bar.
* @see CustomTitleBar
* @see #createCustomTitleBar()
*/
void setCustomTitleBar(Frame frame, CustomTitleBar customTitleBar);
/**
* If {@code customTitleBar} is not null, system-provided title bar is removed and client area is extended to the
* top of the dialog with window controls painted over the client area.
* {@code customTitleBar=null} resets to the default appearance with system-provided title bar.
* @see CustomTitleBar
* @see #createCustomTitleBar()
*/
void setCustomTitleBar(Dialog dialog, CustomTitleBar customTitleBar);
/**
* You must {@linkplain CustomTitleBar#setHeight(float) set title bar height} before adding it to a window.
* @see CustomTitleBar
* @see #setCustomTitleBar(Frame, CustomTitleBar)
* @see #setCustomTitleBar(Dialog, CustomTitleBar)
*/
CustomTitleBar createCustomTitleBar();
/**
* Custom title bar allows merging of window content with native title bar,
* which is done by treating title bar as part of client area, but with some
* special behavior like dragging or maximizing on double click.
* Custom title bar has {@linkplain CustomTitleBar#getHeight() height} and controls.
* @implNote Behavior is platform-dependent, only macOS and Windows are supported.
* @see #setCustomTitleBar(Frame, CustomTitleBar)
*/
interface CustomTitleBar {
/**
* @return title bar height, measured in pixels from the top of client area, i.e. excluding top frame border.
*/
float getHeight();
/**
* @param height title bar height, measured in pixels from the top of client area,
* i.e. excluding top frame border. Must be > 0.
*/
void setHeight(float height);
/**
* @see #putProperty(String, Object)
*/
Map<String, Object> getProperties();
/**
* @see #putProperty(String, Object)
*/
void putProperties(Map<String, ?> m);
/**
* Windows & macOS properties:
* <ul>
* <li>{@code controls.visible} : {@link Boolean} - whether title bar controls
* (minimize/maximize/close buttons) are visible, default = true.</li>
* </ul>
* Windows properties:
* <ul>
* <li>{@code controls.width} : {@link Number} - width of block of buttons (not individual buttons).
* Note that dialogs have only one button, while frames usually have 3 of them.</li>
* <li>{@code controls.dark} : {@link Boolean} - whether to use dark or light color theme
* (light or dark icons respectively).</li>
* <li>{@code controls.<layer>.<state>} : {@link Color} - precise control over button colors,
* where {@code <layer>} is one of:
* <ul><li>{@code foreground}</li><li>{@code background}</li></ul>
* and {@code <state>} is one of:
* <ul>
* <li>{@code normal}</li>
* <li>{@code hovered}</li>
* <li>{@code pressed}</li>
* <li>{@code disabled}</li>
* <li>{@code inactive}</li>
* </ul>
* </ul>
*/
void putProperty(String key, Object value);
/**
* @return space occupied by title bar controls on the left (px)
*/
float getLeftInset();
/**
* @return space occupied by title bar controls on the right (px)
*/
float getRightInset();
/**
* By default, any component which has no cursor or mouse event listeners set is considered transparent for
* native title bar actions. That is, dragging simple JPanel in title bar area will drag the
* window, but dragging a JButton will not. Adding mouse listener to a component will prevent any native actions
* inside bounds of that component.
* <p>
* This method gives you precise control of whether to allow native title bar actions or not.
* <ul>
* <li>{@code client=true} means that mouse is currently over a client area. Native title bar behavior is disabled.</li>
* <li>{@code client=false} means that mouse is currently over a non-client area. Native title bar behavior is enabled.</li>
* </ul>
* <em>Intended usage:
* <ul>
* <li>This method must be called in response to all {@linkplain java.awt.event.MouseEvent mouse events}
* except {@link java.awt.event.MouseEvent#MOUSE_EXITED} and {@link java.awt.event.MouseEvent#MOUSE_WHEEL}.</li>
* <li>This method is called per-event, i.e. when component has multiple listeners, you only need to call it once.</li>
* <li>If this method hadn't been called, title bar behavior is reverted back to default upon processing the event.</li>
* </ul></em>
* Note that hit test value is relevant only for title bar area, e.g. calling
* {@code forceHitTest(false)} will not make window draggable via non-title bar area.
*
* <h2>Example:</h2>
* Suppose you have a {@code JPanel} in the title bar area. You want it to respond to right-click for
* some popup menu, but also retain native drag and double-click behavior.
* <pre>
* CustomTitleBar titlebar = ...;
* JPanel panel = ...;
* MouseAdapter adapter = new MouseAdapter() {
* private void hit() { titlebar.forceHitTest(false); }
* public void mouseClicked(MouseEvent e) {
* hit();
* if (e.getButton() == MouseEvent.BUTTON3) ...;
* }
* public void mousePressed(MouseEvent e) { hit(); }
* public void mouseReleased(MouseEvent e) { hit(); }
* public void mouseEntered(MouseEvent e) { hit(); }
* public void mouseDragged(MouseEvent e) { hit(); }
* public void mouseMoved(MouseEvent e) { hit(); }
* };
* panel.addMouseListener(adapter);
* panel.addMouseMotionListener(adapter);
* </pre>
*/
void forceHitTest(boolean client);
Window getContainingWindow();
}
}

View File

@@ -1,53 +0,0 @@
/*
* Copyright 2000-2023 JetBrains s.r.o.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation. Oracle designates this
* particular file as subject to the "Classpath" exception as provided
* by Oracle in the LICENSE file that accompanied this code.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package com.jetbrains;
import java.awt.*;
public interface WindowMove {
/**
* Starts moving the top-level parent window of the given window together with the mouse pointer.
* The intended use is to facilitate the implementation of window management similar to the way
* it is done natively on the platform.
*
* Preconditions for calling this method:
* <ul>
* <li>WM supports _NET_WM_MOVE_RESIZE (this is checked automatically when an implementation
* of this interface is obtained).</li>
* <li>Mouse pointer is within this window's bounds.</li>
* <li>The mouse button specified by {@code mouseButton} is pressed.</li>
* </ul>
*
* Calling this method will make the window start moving together with the mouse pointer until
* the specified mouse button is released or Esc is pressed. The conditions for cancelling
* the move may differ between WMs.
*
* @param mouseButton indicates the mouse button that was pressed to start moving the window;
* must be one of {@code MouseEvent.BUTTON1}, {@code MouseEvent.BUTTON2},
* or {@code MouseEvent.BUTTON3}.
*/
void startMovingTogetherWithMouse(Window window, int mouseButton);
}

View File

@@ -2,5 +2,6 @@
<dependencies>
<module name="intellij.platform.jewel.ui" />
<module name="intellij.platform.jewel.foundation" />
<module name="intellij.platform.jewel.intUi.standalone" />
</dependencies>
</idea-plugin>

View File

@@ -17,6 +17,7 @@ kotlinpoet = "2.1.0"
kotlinterGradlePlugin = "5.0.1"
kotlinxSerialization = "1.8.0"
ktfmtGradlePlugin = "0.23.0"
jbr = "1.6.0"
[libraries]
assertj-core = { module = "org.assertj:assertj-core", version.ref = "assertJ"}
@@ -39,6 +40,7 @@ jna-core = { module = "net.java.dev.jna:jna", version.ref = "jna" }
junit-jupiter = { module = "org.junit.jupiter:junit-jupiter", version.ref = "jupiter" }
intellijPlatform-util-ui = { module = "com.jetbrains.intellij.platform:util-ui", version.ref = "intelliJPlatformBuild" }
intellijPlatform-icons = { module = "com.jetbrains.intellij.platform:icons", version.ref = "intelliJPlatformBuild" }
jbr-api = { module = "org.jetbrains.runtime:jbr-api", version.ref = "jbr" }
# Plugin libraries for build-logic's convention plugins to use to resolve the types/tasks coming from these plugins
detekt-gradlePlugin = { module = "io.gitlab.arturbosch.detekt:detekt-gradle-plugin", version.ref = "detekt" }

View File

@@ -21,11 +21,11 @@ jvm_resources(
jvm_library(
name = "jewel-intUi-decoratedWindow",
module_name = "intellij.platform.jewel.intUi.decoratedWindow",
visibility = ["//visibility:public"],
srcs = glob(["src/main/kotlin/**/*.kt", "src/main/kotlin/**/*.java"], allow_empty = True),
srcs = glob([], allow_empty = True),
kotlinc_opts = ":custom",
deps = [
runtime_deps = [
":jewel-intUi-decoratedWindow_resources",
"@lib//:kotlin-stdlib",
"@lib//:kotlinx-coroutines-core",
"@lib//:jetbrains-annotations",
@@ -34,8 +34,6 @@ jvm_library(
"//libraries/compose-foundation-desktop",
"//platform/jewel/foundation",
"//platform/jewel/int-ui/int-ui-standalone:jewel-intUi-standalone",
],
runtime_deps = [":jewel-intUi-decoratedWindow_resources"],
plugins = ["@lib//:compose-plugin"]
]
)
### auto-generated section `build intellij.platform.jewel.intUi.decoratedWindow` end
### auto-generated section `build intellij.platform.jewel.intUi.decoratedWindow` end

View File

@@ -1,34 +0,0 @@
f:org.jetbrains.jewel.intui.window.DecoratedWindowIconKeys
- sf:$stable:I
- sf:INSTANCE:org.jetbrains.jewel.intui.window.DecoratedWindowIconKeys
- f:getClose():org.jetbrains.jewel.ui.icon.IconKey
- f:getMaximize():org.jetbrains.jewel.ui.icon.IconKey
- f:getMinimize():org.jetbrains.jewel.ui.icon.IconKey
- f:getRestore():org.jetbrains.jewel.ui.icon.IconKey
f:org.jetbrains.jewel.intui.window.IntUiDecoratedWindowResourceResolverKt
- sf:decoratedWindowPainterProvider(java.lang.String):org.jetbrains.jewel.ui.painter.ResourcePainterProvider
f:org.jetbrains.jewel.intui.window.IntUiThemeKt
- sf:decoratedWindow(org.jetbrains.jewel.ui.ComponentStyling,org.jetbrains.jewel.window.styling.DecoratedWindowStyle,org.jetbrains.jewel.window.styling.TitleBarStyle):org.jetbrains.jewel.ui.ComponentStyling
- bs:decoratedWindow$default(org.jetbrains.jewel.ui.ComponentStyling,org.jetbrains.jewel.window.styling.DecoratedWindowStyle,org.jetbrains.jewel.window.styling.TitleBarStyle,I,java.lang.Object):org.jetbrains.jewel.ui.ComponentStyling
f:org.jetbrains.jewel.intui.window.styling.IntUiDecoratedWindowStylingKt
- sf:dark(org.jetbrains.jewel.window.styling.DecoratedWindowStyle$Companion,org.jetbrains.jewel.window.styling.DecoratedWindowColors,org.jetbrains.jewel.window.styling.DecoratedWindowMetrics):org.jetbrains.jewel.window.styling.DecoratedWindowStyle
- bs:dark$default(org.jetbrains.jewel.window.styling.DecoratedWindowStyle$Companion,org.jetbrains.jewel.window.styling.DecoratedWindowColors,org.jetbrains.jewel.window.styling.DecoratedWindowMetrics,I,java.lang.Object):org.jetbrains.jewel.window.styling.DecoratedWindowStyle
- sf:dark-WkMS-hQ(org.jetbrains.jewel.window.styling.DecoratedWindowColors$Companion,J,J):org.jetbrains.jewel.window.styling.DecoratedWindowColors
- bs:dark-WkMS-hQ$default(org.jetbrains.jewel.window.styling.DecoratedWindowColors$Companion,J,J,I,java.lang.Object):org.jetbrains.jewel.window.styling.DecoratedWindowColors
- sf:defaults-3ABfNKs(org.jetbrains.jewel.window.styling.DecoratedWindowMetrics$Companion,F):org.jetbrains.jewel.window.styling.DecoratedWindowMetrics
- bs:defaults-3ABfNKs$default(org.jetbrains.jewel.window.styling.DecoratedWindowMetrics$Companion,F,I,java.lang.Object):org.jetbrains.jewel.window.styling.DecoratedWindowMetrics
- sf:light(org.jetbrains.jewel.window.styling.DecoratedWindowStyle$Companion,org.jetbrains.jewel.window.styling.DecoratedWindowColors,org.jetbrains.jewel.window.styling.DecoratedWindowMetrics):org.jetbrains.jewel.window.styling.DecoratedWindowStyle
- bs:light$default(org.jetbrains.jewel.window.styling.DecoratedWindowStyle$Companion,org.jetbrains.jewel.window.styling.DecoratedWindowColors,org.jetbrains.jewel.window.styling.DecoratedWindowMetrics,I,java.lang.Object):org.jetbrains.jewel.window.styling.DecoratedWindowStyle
- sf:light-WkMS-hQ(org.jetbrains.jewel.window.styling.DecoratedWindowColors$Companion,J,J):org.jetbrains.jewel.window.styling.DecoratedWindowColors
- bs:light-WkMS-hQ$default(org.jetbrains.jewel.window.styling.DecoratedWindowColors$Companion,J,J,I,java.lang.Object):org.jetbrains.jewel.window.styling.DecoratedWindowColors
f:org.jetbrains.jewel.intui.window.styling.IntUiTitleBarStylingKt
- sf:dark(org.jetbrains.jewel.window.styling.TitleBarStyle$Companion,org.jetbrains.jewel.window.styling.TitleBarColors,org.jetbrains.jewel.window.styling.TitleBarMetrics,org.jetbrains.jewel.window.styling.TitleBarIcons,androidx.compose.runtime.Composer,I,I):org.jetbrains.jewel.window.styling.TitleBarStyle
- sf:dark-a6iJyiw(org.jetbrains.jewel.window.styling.TitleBarColors$Companion,J,J,J,J,J,J,J,J,J,J,J,J,J,androidx.compose.runtime.Composer,I,I,I):org.jetbrains.jewel.window.styling.TitleBarColors
- sf:defaults(org.jetbrains.jewel.window.styling.TitleBarIcons$Companion,org.jetbrains.jewel.ui.icon.IconKey,org.jetbrains.jewel.ui.icon.IconKey,org.jetbrains.jewel.ui.icon.IconKey,org.jetbrains.jewel.ui.icon.IconKey):org.jetbrains.jewel.window.styling.TitleBarIcons
- bs:defaults$default(org.jetbrains.jewel.window.styling.TitleBarIcons$Companion,org.jetbrains.jewel.ui.icon.IconKey,org.jetbrains.jewel.ui.icon.IconKey,org.jetbrains.jewel.ui.icon.IconKey,org.jetbrains.jewel.ui.icon.IconKey,I,java.lang.Object):org.jetbrains.jewel.window.styling.TitleBarIcons
- sf:defaults-LgNEgRQ(org.jetbrains.jewel.window.styling.TitleBarMetrics$Companion,F,F,F,J):org.jetbrains.jewel.window.styling.TitleBarMetrics
- bs:defaults-LgNEgRQ$default(org.jetbrains.jewel.window.styling.TitleBarMetrics$Companion,F,F,F,J,I,java.lang.Object):org.jetbrains.jewel.window.styling.TitleBarMetrics
- sf:light(org.jetbrains.jewel.window.styling.TitleBarStyle$Companion,org.jetbrains.jewel.window.styling.TitleBarColors,org.jetbrains.jewel.window.styling.TitleBarMetrics,org.jetbrains.jewel.window.styling.TitleBarIcons,androidx.compose.runtime.Composer,I,I):org.jetbrains.jewel.window.styling.TitleBarStyle
- sf:light-a6iJyiw(org.jetbrains.jewel.window.styling.TitleBarColors$Companion,J,J,J,J,J,J,J,J,J,J,J,J,J,androidx.compose.runtime.Composer,I,I,I):org.jetbrains.jewel.window.styling.TitleBarColors
- sf:lightWithLightHeader(org.jetbrains.jewel.window.styling.TitleBarStyle$Companion,org.jetbrains.jewel.window.styling.TitleBarColors,org.jetbrains.jewel.window.styling.TitleBarMetrics,org.jetbrains.jewel.window.styling.TitleBarIcons,androidx.compose.runtime.Composer,I,I):org.jetbrains.jewel.window.styling.TitleBarStyle
- sf:lightWithLightHeader-a6iJyiw(org.jetbrains.jewel.window.styling.TitleBarColors$Companion,J,J,J,J,J,J,J,J,J,J,J,J,J,androidx.compose.runtime.Composer,I,I,I):org.jetbrains.jewel.window.styling.TitleBarColors

View File

@@ -1 +0,0 @@
androidx/compose/**

View File

@@ -27,13 +27,12 @@
<exclude-output />
<content url="file://$MODULE_DIR$">
<sourceFolder url="file://$MODULE_DIR$/src/main/resources" type="java-resource" />
<sourceFolder url="file://$MODULE_DIR$/src/main/kotlin" isTestSource="false" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="library" name="kotlin-stdlib" level="project" />
<orderEntry type="library" name="kotlinx-coroutines-core" level="project" />
<orderEntry type="library" name="jetbrains-annotations" level="project" />
<orderEntry type="sourceFolder" forTests="false" />
<orderEntry type="module" module-name="intellij.platform.jewel.decoratedWindow" />
<orderEntry type="module" module-name="intellij.platform.jewel.ui" />
<orderEntry type="module" module-name="intellij.libraries.compose.foundation.desktop" />