On Thu, 24 Mar 2022 14:27:46 GMT, Alexey Ushakov <a...@openjdk.org> wrote:

>> src/java.desktop/macosx/classes/sun/lwawt/LWWindowPeer.java line 298:
>> 
>>> 296:             Color color = getBackground();
>>> 297:             if (color != null) {
>>> 298:                 platformWindow.setBackground(color);
>> 
>> If it skips the texture property I guess it will break it?
>> I think the easiest solution for this issue is to add a new method to the 
>> LWWindowPeer:
>>  ```
>>    public void setBackground(final Color c) {
>>         Color oldBg = getBackground();
>>         if (oldBg == c || (oldBg != null && oldBg.equals(c))) {
>>             return;
>>         }
>>         super.setBackground(c);
>>         updateOpaque();
>>     }
>> }
>
>> If it skips the texture property I guess it will break it?
> I've not noticed it in my testing. Do you mean particular tests? But anyway 
> your suggestion looks more elegant and it works in my scenarios, also I've 
> run test-jdk_desktop_part1 with it. No related problem was found.

The CPlatformWindow.setOpaque() changes the background of the native window 
only if the texture property is not set. So if the code will change the color 
directly somewhere then the texture property will be broken. Not sure that we 
have a test for that.
Please update the copyright date.

-------------

PR: https://git.openjdk.java.net/jdk/pull/7931

Reply via email to