On Fri, 24 Feb 2023 00:14:03 GMT, Thiago Milczarek Sayao <[email protected]>
wrote:
>> Simple fix to get the scroll deltas from GDK_SCROLL_SMOOTH. If we ignore
>> this scroll event type, deltas are sent to java with the value equal to zero.
>>
>> Here's whats happening:
>>
>> We include all event masks, so when using gtk3 (>= 3.4.0) it includes
>> `GDK_SMOOTH_SCROLL_MASK` meaning we receive duplicated events, one with
>> `direction = GDK_SMOOTH_SCROLL_MASK` and other with "legacy" direction
>> (UP/DOWN).
>>
>> When receiving the event corresponding to `GDK_SMOOTH_SCROLL_MASK` we
>> ignored it causing it to send deltas (x,y) = 0.
>>
>> The fix now checks if `GDK_SMOOTH_SCROLL_MASK` is supported and uses it,
>> also adding smooth scroll functionality.
>
> Thiago Milczarek Sayao has updated the pull request incrementally with one
> additional commit since the last revision:
>
> Rename var
I haven't tested this, but I left a couple questions.
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?
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;`
-------------
PR: https://git.openjdk.org/jfx/pull/1044