Review request for 7124236: [macosx] Some components lost shadows after the latest fix of translucent windows.
anthony.petrov at oracle.com
Fri Feb 3 04:22:00 PST 2012
On 2/3/2012 4:05 PM, Dmitry Cherepanov wrote:
>> Major concern: is that possible to avoid modifications to the shared
>> code with this fix?
> I'm afraid that this is a necessary change if we want to create a
> CALayer where the background is fully transparent. Also, having fully
> transparent background in CALayer seems to be necessary to implement
> http://java.net/jira/browse/MACOSX_PORT-764 . I'm currently trying to
> come up with a fix for the native textured background and likely I'll
> submit a separate review request for MACOSX_PORT-764.
I wonder how are we going to differentiate between the fully transparent
background of the layer which is supposed to make the native textured
background shine through, and fully transparent areas painted by user's
code explicitly. Those user areas must actually be fully transparent
visually, too. Do you have an idea how to resolve that?
Also, I see that 764 is basically an RFE. Does it make sense to fix it
in JDK8 rather than in 7u? In this case changes to the shared code would
be all fine.
>> On 1/31/2012 11:04 PM, Dmitry Cherepanov wrote:
>>> The cause of the problem with broken shadows is that currently
>>> NSWindow's background color is [NSWindow clearColor] and it makes
>>> shadows invisible. The fix implements Mike's suggestion and now we
>>> draw pure transparent pixels into a CALayer so that the native
>>> background color will be visible through transparent areas of the
>> Looks like it should work fine if background's alpha is > 0 and < 255.
>> And what about window.setBackground(new Color(0, 0, 0, 0))? I see that
>> in CPlatformWindow we'll actually pass these zeros (which is in fact
>> the same as the clearColor, isn't it?) to the native system. In this
>> case I wouldn't expect any shadow to appear since the background color
>> set is completely transparent. Is this correct?
> I would also expect that there shouldn't be any shadow after setting
> window.setBackground(new Color(0, 0, 0, 0)) and this is how it behaves now.
To me this seems like the most common use case for transparent windows.
Are we, or rather are developers OK with missing window shadows in that
case? From developer's perspective it seems that shadow must be present
regardless of the background color set to the window.
>> Also, the bug evaluation mentions the click-through problem. Is it
>> resolved with this fix?
> The patch doesn't solve the click-through problem. I've spent a while
> investigating this issue and there's a number of mailing threads (for
> example,  and ) mentioning that OpenGL content is opaque to events.
This basically means that with current implementation transparent
windows behave on the Mac the same way they do on X11 which is far from
being... hmmm... convenient. To worsen thing, Mac doesn't support
Shapes, which makes it absolutely impossible to implement normal
non-opaque windows with click-through capability on Mac OS with
AWT/Swing. I think this is a problem.
The thread  mentions that using renderInContext: can actually produce
satisfying results - i.e. make visually transparent areas transparent
for mouse clicks, too. And this is actually what we really want, isn't it?
>  http://lists.apple.com/archives/cocoa-dev/2009/Apr/msg01945.html
>  http://lists.apple.com/archives/mac-opengl/2010/Mar/msg00038.html
More information about the macosx-port-dev