RFR: 8292922 - [Linux] No more drag events when new Stage is created in drag handler [v6]

Kevin Rushforth kcr at openjdk.org
Fri Dec 23 13:33:57 UTC 2022


On Wed, 21 Dec 2022 12:56:12 GMT, Thiago Milczarek Sayao <tsayao at openjdk.org> wrote:

>> This PR  was previously discussed on #905.
>> 
>> The approach is to grab the keyboard focus so the window that originated the drag will keep it.
>> 
>> I did some cleanup on grabbing related functions as well.
>> 
>> `gdk_keyboard_focus()` is deprecated, so is `gdk_device*` functions in favor of `gdk_seat*`. But that's only available in later Gtk versions. I checked and newer Gtk will use `gdk_seat*` inside the deprecated `gdk_keyboard_focus()`.
>> 
>> Edit:
>> 
>> The current changes uses another approach that is to not ungrab pointer device when focus is received on another window. There's also some cleanup on grabbing related functions and grab moved from starting on mouse click to the actual drag.
>
> Thiago Milczarek Sayao has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Grab drag focus on drag

I took a second look at the code that calls `grab_mouse_drag_focus`, which was changed to call it on a drag start rather than on a mouse click, and it looks like there is a problem with the way it is now implemented. It will now be called multiple times during a drag operation, instead of just at the start of the drag operation.

modules/javafx.graphics/src/main/native-glass/gtk/glass_window.cpp line 353:

> 351:         // and no exit/enter event should be reported during this drag.
> 352:         // We can grab mouse pointer for these needs.
> 353:         grab_mouse_drag_focus();

Now that this code has moved here, it will be called every time the mouse moves during a drag operation. It should only be called once when the drag first starts.

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

Changes requested by kcr (Lead).

PR: https://git.openjdk.org/jfx/pull/977


More information about the openjfx-dev mailing list