Skip to content

[JEWEL-1285] Update JDialogRenderer to Support Custom Window Shape#3449

Open
DanielSouzaBertoldi wants to merge 1 commit intoJetBrains:masterfrom
DanielSouzaBertoldi:dsb/JEWEL-1285
Open

[JEWEL-1285] Update JDialogRenderer to Support Custom Window Shape#3449
DanielSouzaBertoldi wants to merge 1 commit intoJetBrains:masterfrom
DanielSouzaBertoldi:dsb/JEWEL-1285

Conversation

@DanielSouzaBertoldi
Copy link
Collaborator

@DanielSouzaBertoldi DanielSouzaBertoldi commented Mar 5, 2026

Context

During the development of the Got It component, we ran into a limitation of our current JDialogRenderer. Currently, it can only render windows with rounded corners. While this works perfectly for menus and other types of popups, it fails to provide the best UX for the Got It component since it has a custom shape.

So, this PR paves the way so that our Got It component can be rendered in all its glory!

Changes

  • Created new variations of Popup that take windowShape: ((IntSize) -> java.awt.Shape)? = null,. Deprecated variations without it.
  • Added windowShape: ((IntSize) -> java.awt.Shape)? = null, lambda parameter to PopupRenderer and passed it down to both JDialogRenderer and JBPopupRenderer
  • Updated JDialogRenderer code to apply the custom window shape defined by the factory lambda if:
    1. compose.interop.blending is disabled
    2. windowShape is not null

Demo

Scenario Screenshot
Before image
After image
Custom Popup Enabled, Window Shape Provided but Compose Blending Disabled
Screen.Recording.2026-03-05.at.16.08.49.mov

Closeup of Jagged Arrow Shape

Note

Keep in mind this only ever happens if users provide a custom shape via the new factory parameter AND don't enable compose.interop.blending!

Scenario Screenshot
Arrow pointing up image
Arrow pointing down image
Arrow pointing left image

Curiously, this minor artifact is not present when the arrow is to the right. No idea why, though.

Release notes

New features

  • New variations of Popup is available which take a windowShape factory. With this, you can create a custom shape that'll be applied to the window which holds the popup. Bear in mind that this factory is only useful in the following scenario:
    • You have the system property jewel.customPopupRender flag enabled
    • Your project is running as a Desktop app. IJP plugins are unaffected by this change
    • Your project does not have the system property compose.interop.blending enabled
  • Keep in mind that forcing to clip the window to a shape has some limitations: Swing's WindowTranslucency can't render concave corners properly since it forces pixels to be either completely off or on. This means that depending on your custom shape, you can have jagged edges. For this reason, it's highly encouraged to also enable compose.interop.blending in your system properties.

Deprecated API

  • Popup components without the windowShape parameter are now deprecated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant