I have no idea if you have contributed to OpenJDK before.,
If you have not, follow the instructions at
https://openjdk.org/guide/#sign-the-oca
and in general read as much of that guide as makes sense for you.
After that I suggest a ROUGH draft github PR be posted here, so we can
see what it
actually looks like in practice before you spend too much time on it.
-phil.
On 2/22/24 8:49 PM, Povilas Kanapickas wrote:
Hi Philip,
Thanks for a quick response. I will reply inline.
On 2024-02-23 06:11, Philip Race wrote:
First, thank you for raising it this way rather than submitting a PR !
In general things that compatibly and safely improve the user experience
are welcome.
So at a high level, yes. So the next level is the details to think about
it more ?
How important is smooth scrolling ? I've never noticed not having it.
Does it imply more ?
Perhaps I should have used different terminology - pixel-perfect or
high-resolution scrolling. The most visible artifact is that in a text
view it's impossible to scroll by less than 3 line increments.
How much of this is useful without adding new API and therefore
applicable to 10 year old applications ?
You speak of X11, but what about mac and windows ?
Windows and Mac already has this.
I believe that if application supports high-resolution scrolling on Mac
or Windows then it should work on X11 without any changes. It will just
get MouseWheelEvent in exactly the same way as on these platforms.
However, application may have special code for e.g. emulating smooth
scrolling on X11. In such case it will require changes to disable this
code and just use Mac/Windows code path when native support is available.
And even for X11, we are (very slowly !) moving towards Wayland for the
future, so if this is just an X11-specific
implementation stop-gap, is it worth the effort ?
I actually considered this exact question when deciding whether to
pursue this. To me it seemed that awt on Wayland won't happen sooner
than in 5 years. There's XWayland compatibility layer which means
there's actually no real urgency to port applications to wayland because
this doesn't offer any tangible benefit. And the amount of code in
sun.awt.X11 is huge.
Of course I could be completely wrong here as you know the openjdk
priorities much better than I do :-)
If it is a contained, low risk, implementation only change, with no
changes to apps and benefits to users,
those are all good signs.
I'm glad to hear that.
Thanks a lot,
Povilas
I invite others to chime in, especially anyone who knows something about
this X11 extension.
-phil
On 2/22/24 6:23 PM, Povilas Kanapickas wrote:
Hello,
I would like to add smooth scrolling support to sun.awt.X11. At this
point of time I already have this feature implemented. The code can be
considered proof of concept right now, but it works and doesn't
introduce regressions in all test scenarios I've done so far.
Is this something that The Client Libraries Group would be interested in?
The implementation consists of two parts.
The first is adding support for X Input Extension 2.x protocol (XInput2)
to sun.awt.X11. This protocol is quite different from the core X
protocol that is currently used for input. Fortunately, it is possible
to map XInput2 events back to core X input events almost exactly. Thus
the addition for this new protocol involves relatively few code changes.
Different functions need to be called here and there, but the bulk of
code is reused as is by converting XInput2 events to core X input
events. This reduces the risk of any regressions significantly.
The second part is relatively simple wiring of XInput2 smooth scrolling
events to MouseWheelEvent.
This work would also lay ground for supporting gestures such as swipe or
rotate on X11. This could be useful when these gestures are exposed in
awt in the future. I implemented support for these gestures in the X
server a couple of years ago and could potentially help exposing them in
awt on macos and x11 too.
Please let me know what you think about all this on a high level.
Thank you,
Povilas Kanapickas