RFR: 8273379: GTK3 stops sending key events during drag and drop [v32]

Martin Fox duke at openjdk.org
Sat May 27 17:37:14 UTC 2023


On Sat, 6 May 2023 21:20:59 GMT, Thiago Milczarek Sayao <tsayao at openjdk.org> wrote:

>> This PR fixes 8273379.
>> 
>> I reverted back to use GDK (from [8225571](https://bugs.openjdk.org/browse/JDK-8225571)) to handle the events. 
>> 
>> It may also fix [8280383](https://bugs.openjdk.org/browse/JDK-8280383).
>> 
>> There's also some cleaup.
>> 
>> To do general testing (two tests were added):
>> `java @build/run.args -jar apps/toys/DragDrop/dist/DragDrop.jar`
>> 
>> Information for reviewing:
>> * Previously an offscreen window where used to pass events. Now it gets the window were Drag initially started  (`WindowContextBase::sm_mouse_drag_window`);
>> * There's a new `DragSourceContext` instead of global variables;
>> * DragView were simplified;
>> * It handles `GDK_GRAB_BROKEN` events (I still need to figure it out a test case for this - It should happen when another window grabs the device during the drag);
>> * There's a special case for `GDK_BUTTON_RELEASE` because `WindowContext` will notify java about the button release and set `DnDGesture` to null before the end of the DND.
>> * `gdk_drag_find_window_for_screen` -> pass the DragView window to be ignored (as it would "steal" destination motion events);
>> * The Scenario were the drag source window closes during the drag is now covered;
>> * It does not rely on `gdk_threads_add_idle` because it may be inconsistent.
>> 
>> 
>> ![image](https://user-images.githubusercontent.com/30704286/213877115-18f274ff-18c9-4d38-acc4-449f24174ecc.png)
>> ![image](https://user-images.githubusercontent.com/30704286/213877140-1d24c293-d70f-46e6-b040-c49170d2aa9a.png)
>
> Thiago Milczarek Sayao has updated the pull request with a new target base due to a merge or a rebase. The pull request now contains 78 commits:
> 
>  - Merge branch 'master' into 8273379-dnd-keys
>  - Merge branch 'master' into 8273379-dnd-keys
>  - Merge branch 'master' into 8273379-dnd-keys
>  - Merge branch 'openjdk:master' into master
>  - Merge branch 'openjdk:master' into master
>  - Merge branch 'openjdk:master' into master
>  - Merge branch 'openjdk:master' into master
>  - Merge branch 'openjdk:master' into master
>  - Merge branch 'openjdk:master' into master
>  - Merge branch 'openjdk:master' into master
>  - ... and 68 more: https://git.openjdk.org/jfx/compare/c50ce609...53ee86e8

I don't think the original bug should be fixed as written. On both Mac and Windows the platform drag-and-drop system consumes all key events (well, on the Mac we see some `keyUp:` events but not for modifiers). That's a good thing, it prevents the user from invoking shortcuts that might close the app or source window. I don't see why Linux should be any different. It would be very odd for a UI toolkit to allow key events through during drag-and-drop and even odder if that only happened on one platform.

Whoever reported that bug has a problem they're trying to solve but I think they proposed the wrong solution.

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

PR Comment: https://git.openjdk.org/jfx/pull/986#issuecomment-1565609807


More information about the openjfx-dev mailing list