RFR: 8297923: java.awt.ScrollPane broken after multiple scroll up/down

Alexey Ivanov aivanov at openjdk.org
Tue Jun 6 18:48:00 UTC 2023


On Tue, 6 Jun 2023 18:38:10 GMT, Harshitha Onkar <honkar at openjdk.org> wrote:

>> src/java.desktop/windows/native/libawt/windows/awt_ScrollPane.cpp line 745:
>> 
>>> 743:     ssps->y = y;
>>> 744: 
>>> 745:     AwtToolkit::GetInstance().InvokeFunctionLater(AwtScrollPane::_SetScrollPos, ssps);
>> 
>> Whereas in the _GetOffset case above, you clearly need to wait until the result is returned - I guess
>> you didn't see a need to block here ? Or the case below ?
>
> I had a similar clarification as to why it was `InvokeFunction` for `_getOffset` and `InvokeFunctionLater` for `_SetScrollPos` and `_SetSpans`. The above discussion makes it clear.

No, there's no need to wait, and no result is returned.

Java has updated the position of the child component based on the new position of the scroll bar. Now the position of the non-client scroll bars of the scroll pane window need to be updated.

The `_SetSpans` recalculates the position and range of the scroll bars if the size of the scroll pane or its child component changes. The changes are already handled on the Java side, these changes need to be reflected in the scroll bars.

I have found no scenario where we need to block EDT.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/14338#discussion_r1220141017



More information about the client-libs-dev mailing list