RFR: 8303038: Glass gtk3 sends scroll events with delta(x, y) = 0 [v4]
Thiago Milczarek Sayao
tsayao at openjdk.org
Wed Mar 1 16:06:30 UTC 2023
On Wed, 1 Mar 2023 15:07:37 GMT, Kevin Rushforth <kcr at openjdk.org> wrote:
>> Thiago Milczarek Sayao has updated the pull request incrementally with one additional commit since the last revision:
>>
>> Rename var
>
> modules/javafx.graphics/src/main/native-glass/gtk/glass_window.cpp line 390:
>
>> 388: if (gdk_window_get_events(gdk_window) & GDK_SMOOTH_SCROLL_MASK) {
>> 389: is_smooth = true;
>> 390: if (event->direction == GDK_SCROLL_SMOOTH) {
>
> When would `GDK_SMOOTH_SCROLL_MASK` be set with direction not equal to `GDK_SCROLL_SMOOTH`? In this case, you will use a dx and dy value of 0 (which will at least now be ignored with your fix). Is this correct?
Correct.
`direction`:
The direction to scroll to (one of `GDK_SCROLL_UP`, `GDK_SCROLL_DOWN`, `GDK_SCROLL_LEFT`, `GDK_SCROLL_RIGHT ` or `GDK_SCROLL_SMOOTH`).
If the device supports it and if event mask is set to contain `GDK_SMOOTH_SCROLL_MASK `, gdk will send `GDK_SCROLL_SMOOTH` with the deltas equivalent to the device sensor. But it will also send the others for compatibilty (I guess).
We set to receive all events. When gtk3 introduced `GDK_SMOOTH_SCROLL_MASK` (*) we started receiving it but not accounting it, so resulting in deltas = `0`.
(*) It's set on `WindowContextTop` constructor.
> modules/javafx.graphics/src/main/native-glass/gtk/glass_window.cpp line 419:
>
>> 417: // Note: For gtk negatives values means UP/LEFT, JavaFx is opposite
>> 418: dx = (dx != 0) ? dx * -1 : 0;
>> 419: dy = (dy != 0) ? dy * -1 : 0;
>
> Is avoiding a possible negative 0 is really necessary? If not, this could simplify to `dx *= -1;` and `dy *= -1;`
Will double check it, but I think I spaced out.
-------------
PR: https://git.openjdk.org/jfx/pull/1044
More information about the openjfx-dev
mailing list