RFR: 8187759: Background not refreshed when painting over a transparent JFrame [v2]
Tejesh R
tr at openjdk.org
Fri Feb 2 07:06:04 UTC 2024
On Thu, 1 Feb 2024 16:23:01 GMT, Alexander Zvegintsev <azvegint at openjdk.org> wrote:
>> Tejesh R has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Review fix
>
> src/java.desktop/share/classes/javax/swing/BufferStrategyPaintManager.java line 251:
>
>> 249: g2d.setBackground(paintingComponent.getBackground());
>> 250: g2d.clearRect(x, y, w, h);
>> 251: g2d.setBackground(oldBg);
>
> Shouldn't we limit this change to non-opaque components only?
> `if (!bufferComponent.isOpaque())`
>
> Also, it might be worthwhile to find a way not to clear the whole screen/window area (if possible), but only the dirty part.
Yeah, will updated to non-opaque types. Will explore on clearing the dirty regions rather than whole screen.
> test/jdk/javax/swing/JFrame/JFrameBackgroundRefreshTest.java line 45:
>
>> 43: * @build PassFailJFrame
>> 44: * @summary Test to check if JFrame background is refreshed in Linux.
>> 45: * @requires (os.family == "linux")
>
> Why should this test only run on Linux?
Since the fix was done for linux alone, I have restricted the test to it. Anyhow it works on windows and mac.
> test/jdk/javax/swing/JFrame/JFrameBackgroundRefreshTest.java line 77:
>
>> 75:
>> 76: frame = new JFrame("JFrame Background refresh test");
>> 77: passFailJFrame = new PassFailJFrame("Test Instructions",
>
> This test is unusable with mouse for me(before and after the fix). The windows with the floating text obscures the
> "Pass" and "Fail" buttons.
>
> Also, it looks like this test doesn't have to be manual.
> It can easily be automated, e.g. by moving the mouse cursor over a white window and then moving it away from that window.
> If any non-white pixels are left drawn over the white window, the test fails.
Yeah, couldn't think about an alternative test, to switch from test to PassFail windows we might have select from toolbar. Will work on automating the test.
-------------
PR Review Comment: https://git.openjdk.org/jdk/pull/17081#discussion_r1475635090
PR Review Comment: https://git.openjdk.org/jdk/pull/17081#discussion_r1475635859
PR Review Comment: https://git.openjdk.org/jdk/pull/17081#discussion_r1475637253
More information about the client-libs-dev
mailing list