When I added support for translucent windows to VAqua, I used a different solution: I “tricked” the AWT Window into accepting a transparent (alpha = 0) background color. I’m not sure if this is better or worse than your idea of suppressing the painting of the background, but it does raise the issue of why AWT Windows insist on the background color being opaque. Would something break if that restriction were removed? Using a transparent background color does not seem to cause any problems on macOS and it seems like a natural way for a developer to indicate the desire to have a window with a transparent or translucent background.
> On Mar 27, 2023, at 2:52 PM, Jeremy <[email protected]> wrote: > > The original write-up contains two complaints: > 1. The window is opaque, so pixels that should be transparent are black. > 2. The window is the wrong resolution. On a 200% resolution monitor it > renders as if it were 100% (so it looks pixelated). > > I recommend splitting this up into separate tickets. > > This PR addresses the first (probably most offensive) issue: the window is > now transparent. > > I experimented with a change that resolves the second issue (image > resolution) here: > https://github.com/openjdk/jdk/commit/90735b7c01c66268776998c1b6aedc3250427002 > > ... that works, but IMO that looks riskier and should be part of a separate > discussion. > > I only have a Mac configured right now to test against, so I've confirmed the > MTLGraphicsConfig and CGLGraphicsConfig changes. The other GraphicsConfig > changes are identical, but I haven't confirmed that this new test passes in > those environments. (I did confirm that those GraphicsConfig files appear to > support getColorModel(Transparency.TRANSLUCENT), so I'm optimistic they'll be > OK. > > ------------- > > Commit messages: > - 8303904: fixing compiler `cannot find symbol` errors > - 8303904: cleaning up comment > - 8303904: apply same solution to other GraphicsConfigurations > - 8303904: resolve failing bug8308904_OGL test on Mac > - 8303904: adding failing unit test for OpenGL on Mac > - 8303904: updating instruction text to reflect narrowed focus of this branch > - 8303904: rolling back prev createAcceleratedImage commit > - 8303904: change createAcceleratedImage to return a potentially high-res > image > - 8303904: use Transparency.TRANSLUCENT for non-opaque windows > - 8303904: Add failing unit test > - ... and 4 more: https://git.openjdk.org/jdk/compare/98a7a60f...4284d4cd > > Changes: https://git.openjdk.org/jdk/pull/13196/files > Webrev: https://webrevs.openjdk.org/?repo=jdk&pr=13196&range=00 > Issue: https://bugs.openjdk.org/browse/JDK-8303904 > Stats: 225 lines in 7 files changed: 220 ins; 0 del; 5 mod > Patch: https://git.openjdk.org/jdk/pull/13196.diff > Fetch: git fetch https://git.openjdk.org/jdk.git pull/13196/head:pull/13196 > > PR: https://git.openjdk.org/jdk/pull/13196 >
