No description
  • C 81.8%
  • Shell 11%
  • Python 7.2%
Find a file
anemunt be49073d4e Proton-GE-FL: winex11 fix for black boxes around layered windows on Hyprland
Wine patch (GE hotfix layout) that stops using the alpha-derived X bounding
shape for per-pixel-alpha ARGB layered windows when a compositing manager is
running, and keeps the mask as the input shape. Fixes the FL Studio splash
and About logo rendering with black boxes on Hyprland/Xwayland.

Includes the protonprep-valve-staging.sh hook, rebuild instructions for
GE-Proton11-12, and the layered-window test tools used for validation.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-18 02:26:33 -05:00
patches Proton-GE-FL: winex11 fix for black boxes around layered windows on Hyprland 2026-11-18 02:26:33 -05:00
tests Proton-GE-FL: winex11 fix for black boxes around layered windows on Hyprland 2026-11-18 02:26:33 -05:00
.gitignore Proton-GE-FL: winex11 fix for black boxes around layered windows on Hyprland 2026-11-18 02:26:33 -05:00
README.md Proton-GE-FL: winex11 fix for black boxes around layered windows on Hyprland 2026-11-18 02:26:33 -05:00

Proton-GE-FL

A one-file Wine patch, packaged for Proton-GE's patch system, that fixes black (or stale) boxes around per-pixel-alpha layered windows on Hyprland/Sway. Found with FL Studio 21: the splash screen and the animated About-tab logo.

Built and tested against GE-Proton11-12 (Valve Wine fda79a585939fb7512dc220a11249f9ffe825fcf, wine-staging 6cc805ea57132eeaf44764e9213823c9b8d0d300) on Hyprland 0.57.1 / Xwayland, 2026-11-18.

Root cause

Windows that use UpdateLayeredWindow with per-pixel alpha get a 32-bit ARGB X visual (correct), plus an X bounding shape built from their fully transparent (alpha = 0) pixels (win32u/dce.c: set_surface_shape → winex11.drv/bitblt.c: x11drv_surface_flush).

Hyprland, like several other Wayland compositors, ignores bounding shapes on Xwayland windows. Xwayland never redraws pixels outside the shape, so those areas show whatever the buffer held before. That's black after FL's 16×16 → full-size resize, or the previous animation frame. Partly transparent pixels are unaffected, because they never go through the shape.

Proton already works around this for gamescope only (HACK: Do not shape layered windows on gamescope).

The fix

patches/wine-hotfixes/pending/winex11-alpha-only-shape-under-compositor.patch (only dlls/winex11.drv/bitblt.c).

When all of these hold:

  • the surface has per-pixel alpha (alpha_mask) and uses the ARGB visual,
  • there is no color key and no explicit window region (SetWindowRgn),
  • GE's opt-in WINE_LAYERED_OVERLAY_SHAPE / WINE_LAYERED_OVERLAY_ALPHA modes are off,
  • a compositing manager owns _NET_WM_CM_S<screen> (result cached, re-checked at most once per second),

then the bounding shape is cleared, and the same mask is applied as the input shape, so alpha-0 pixels stay click-through as on Windows. WS_EX_TRANSPARENT windows keep the empty input shape that sync_window_input_shape gives them. Everything else is untouched (color keys, SetWindowRgn, the gamescope hack, all non-layered windows). It only runs inside the existing if (shape_changed) block.

patches/protonprep-hook.patch adds the apply_patch line to patches/protonprep-valve-staging.sh (end of the "WINE PENDING UPSTREAM" section).

Test results (stock GE-Proton11-12 vs patched, same prefix copy)

Check Stock Patched
FL splash, corner pixel (0,0,0) black box background shows through
FL About logo black box correct
Test window over a stale opaque frame stale frame visible transparent
Partial alpha blends blends
WS_EX_TRANSPARENT input shape empty empty
Normal layered window input shape whole window alpha mask (224 rects, same as stock's bounding)
Color-key / SetWindowRgn windows identical shapes and pixels
CPU, About logo animating FL 28.0%, Xwayland 11.9% FL 26.7%, Xwayland 4.1%

Not fixed (also on stock): the logo window follows you across workspaces, some flicker while dragging (less than stock), and color-key/SetWindowRgn areas still show stale content, because Hyprland ignores those shapes too. No synthetic click test was possible; input was checked via X input shapes plus manual use.

Rebuilding (only winex11.so changes)

mkdir -p ~/proton-ge-fl-build && cd ~/proton-ge-fl-build
git clone --depth 1 --branch GE-Proton11-12 https://github.com/GloriousEggroll/proton-ge-custom.git
cd proton-ge-custom
git submodule update --init --filter=blob:none wine        # needs history: prep reverts e813ca5
git submodule update --init --depth 1 wine-staging

# drop in the fix + hook (from this repo)
cp /path/to/Proton-GE-FL/patches/wine-hotfixes/pending/*.patch patches/wine-hotfixes/pending/
patch -Np1 < /path/to/Proton-GE-FL/patches/protonprep-hook.patch

# run only the Wine section of GE's prep (helper functions + section 2)
{ sed -n '1,15p' patches/protonprep-valve-staging.sh
  sed -n '/^### (2) WINE PATCHING ###/,/^### END WINE PATCHING/p' patches/protonprep-valve-staging.sh
} > ../wine-prep-only.sh
bash ../wine-prep-only.sh > ../wine-prep.log 2>&1
grep -nE 'FAILED|\.rej' ../wine-prep.log          # must print nothing

# GE's post-source generators (from Makefile.in .wine-post-source)
cd wine
XDG_CACHE_HOME=$PWD/../../cache dlls/winevulkan/make_vulkan -x vk.xml -X video.xml
tools/make_specfiles
cd ../..

mkdir build-wine64 && cd build-wine64
../proton-ge-custom/wine/configure --enable-win64 --without-mingw --disable-tests
make -j"$(nproc)" dlls/winex11.drv/winex11.so

Check the result has the same dependencies as stock (objdump -p … | grep NEEDED: ntdll.so, win32u.so, libXext, libX11, libm, libc; max GLIBC 2.38 on the 2026-11 build host).

Installing as a separate runner

CT=~/.local/share/Steam/compatibilitytools.d
cp -a --reflink=auto "$CT/Proton-GE Latest" "$CT/GE-Proton11-12-fl"   # must be the same GE version
# in $CT/GE-Proton11-12-fl/compatibilitytool.vdf: rename the tool key and display_name
strip --strip-unneeded -o "$CT/GE-Proton11-12-fl/files/lib/wine/x86_64-unix/winex11.so" \
      build-wine64/dlls/winex11.drv/winex11.so

Then pick GE-Proton11-12-fl as the runner in Faugus. The first launch makes Proton re-link the prefix's builtin DLLs. Native overrides (for example a patched ole32.dll with the builtin marker stripped) survive.

Only the 64-bit winex11.so is replaced. That's fine for 64-bit apps or PROTON_USE_WOW64=1.

On a new GE release

Check out the new tag, copy the patch and hook in again, rerun the prep, and confirm patch -Np1 applied it cleanly (it fails loudly if the context moved), then rebuild winex11.so.

Tests (tests/)

  • build-tests.sh: builds everything (clang-cl, lld-link, llvm-dlltool, gcc + libX11/libXext).
  • lwtest.exe A|B|C|D: layered-window test cases. A = FL-style click-through alpha window, B = same without WS_EX_TRANSPARENT (logs mouse events), C = LWA_COLORKEY, D = ULW + SetWindowRgn. Each shows an opaque yellow frame first, then the real image, so a stale-content bug is visible.
  • harness.sh <runner-dir> <tag>: runs A–D in $TEST_PREFIX (use a throwaway prefix), takes a screenshot (grim) and dumps every window's bounding/input shapes (xshapes).
  • xshapes <name> / xlayered: print X bounding and input shapes, from the whole window tree or from 32-bit top-level windows.
  • probe.exe: lists Win32 windows with layered/transparent ex-styles, across processes.
  • px.py file.png x,y …: prints pixel values from a PNG (stdlib only).