Skip to content

🐛 fix the paste panel corners and menu glyphs on Windows - #5062

Merged
guiyanakuang merged 3 commits into
mainfrom
fix/paste-panel-windows-rendering
Sep 27, 2026
Merged

guiyanakuang merged 3 commits into
mainfrom
fix/paste-panel-windows-rendering

Conversation

@guiyanakuang

@guiyanakuang guiyanakuang commented Sep 27, 2026 •

Copy link
Copy Markdown
Member

Follow-up to #5039 (#4995). On Windows the floating button's right-click menu rendered every label as boxes, and the panel came up square with a grey rectangle showing behind its rounded content.

Menu glyphs

AWT owner-draws its heavyweight menus through the logical-font tables of fontconfig, and PlatformFont maps any physical family a caller sets back to the logical sansserif, so giving the menu a CJK font changes nothing. Since JDK 18 the default encoding is UTF-8, and the Windows tables only carry UTF-8.ja, UTF-8.ko and UTF-8.hi sequences: Chinese falls through to the alphabetic-only default and every label renders as boxes, regardless of locale.

The button menu is therefore shown as a plain Win32 menu on Windows (CreatePopupMenu / TrackPopupMenu), which Windows draws itself with the system UI font and font linking, so any language displays. WindowsPopupMenu runs the modal menu loop on its own thread with a hidden owner window and message loop, the same pattern as the clipboard listeners, and hands the picked action back to the main dispatcher. macOS and Linux keep the AWT PopupMenu (native NSMenu on macOS). The entries are described once as NativeMenuEntry and fed to either implementation.

Panel corners

The panel was a per-pixel-alpha (layered) window with the DWM transient backdrop applied. Two things break there:

  • DWM never rounds a layered window, even with DWMWA_WINDOW_CORNER_PREFERENCE (documented as "cannot ever be rounded"), so the Compose clip was the only rounding.
  • The system backdrop fills the whole HWND rectangle, which is the grey square that showed behind the clipped corners.

Windows now keeps the transparent window purely for the rounded corners and no longer requests the backdrop: the panel paints its own opaque rounded card with a hairline sectionCardBorder. This also applies on Windows 10, which previously fell back to a square opaque window. PastePanelContent takes a small PastePanelSurface (ACRYLIC for macOS, CARD for Windows, PLAIN for Linux) instead of the single transparent flag. macOS and Linux behaviour is unchanged.

Verification

  • app:compileKotlinDesktop and the paste panel tests pass.
  • Windows 11 VM with a local zip build: the rounded card is confirmed; the native menu build is the second round after the font-only attempt was confirmed not to help.

@guiyanakuang
guiyanakuang merged commit c3e2097 into main Sep 27, 2026
7 checks passed
@guiyanakuang
guiyanakuang deleted the fix/paste-panel-windows-rendering branch September 27, 2026 08:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant