From d09d65f1d448ecd8475da2629b5e0ed233eee4fa Mon Sep 17 00:00:00 2001 From: Alexander Lobas Date: Wed, 12 Jul 2023 11:56:50 +0200 Subject: [PATCH] IDEA-325067 No inset between notification and button in Welcome Screen GitOrigin-RevId: a0dad9f1a2cfcaa907832bc746be5c644ee6cf7b --- .../WelcomeBalloonLayoutImpl.java | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/WelcomeBalloonLayoutImpl.java b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/WelcomeBalloonLayoutImpl.java index c0e2fb299ebf..18dbfeb7cf91 100644 --- a/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/WelcomeBalloonLayoutImpl.java +++ b/platform/platform-impl/src/com/intellij/openapi/wm/impl/welcomeScreen/WelcomeBalloonLayoutImpl.java @@ -35,7 +35,6 @@ import static com.intellij.notification.impl.NotificationsManagerImpl.FILL_COLOR public class WelcomeBalloonLayoutImpl extends BalloonLayoutImpl { public static final Topic BALLOON_NOTIFICATION_TOPIC = Topic.create("balloon notification changed", BalloonNotificationListener.class); - private static final int NOTIFICATION_BORDER = 5; private static final String TYPE_KEY = "Type"; private @Nullable Component myLayoutBaseComponent; @@ -166,9 +165,8 @@ public class WelcomeBalloonLayoutImpl extends BalloonLayoutImpl { Dimension layeredSize = Objects.requireNonNull(layeredPane).getSize(); Dimension size = new Dimension(myPopupBalloon.getPreferredSize()); - Point point = SwingUtilities.convertPoint(myLayoutBaseComponent, 0, 0, layeredPane); - Point location = new Point(point.x, point.y + 5); - int x = layeredSize.width - size.width - 5; + Point location = SwingUtilities.convertPoint(myLayoutBaseComponent, 0, 0, layeredPane); + int x = layeredSize.width - size.width; int fullHeight = location.y; if (x > location.x) { @@ -178,7 +176,17 @@ public class WelcomeBalloonLayoutImpl extends BalloonLayoutImpl { size.height = fullHeight; } - myPopupBalloon.setBounds(new Rectangle(x, fullHeight - size.height, size.width - JBUI.scale(NOTIFICATION_BORDER), size.height)); + int locationX = x; + int locationY = fullHeight - size.height; + + if (ShadowJava2DPainter.Companion.enabled()) { + locationX -= JBUI.scale(10); + if (size.height < fullHeight) { + locationY -= JBUI.scale(5); + } + } + + myPopupBalloon.setBounds(new Rectangle(locationX, locationY, size.width, size.height)); } private void updatePopup() {