RFR: 8273379: GTK3 stops sending key events during drag and drop [v30]
Thiago Milczarek Sayao
tsayao at openjdk.org
Sat May 6 20:28:45 UTC 2023
On Sun, 16 Apr 2023 00:03:47 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.
>>
>>
>> 
>> 
>
> 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 76 commits:
>
> - 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
> - Merge branch 'openjdk:master' into master
> - Don't call gdk_device_manager_get_client_pointer() on event processing
> - ... and 66 more: https://git.openjdk.org/jfx/compare/0c03a411...2302657e
modules/javafx.graphics/src/main/native-glass/gtk/GlassApplication.cpp line 450:
> 448: glass_evloop_call_hooks(event);
> 449:
> 450: if (!process_dnd_source(event)) {
This let's the events fall-trough and is the most important part to fix the bug.
Since the glass-gtk implementation uses GDK events, it made sense to go back to GDK for DND.
modules/javafx.graphics/src/main/native-glass/gtk/glass_dnd.cpp line 1014:
> 1012: in_drag = false;
> 1013: return true;
> 1014: }
This fixes a bug that would leave the DragView visible on the screen if the app is closed (ALT+F4) during the drag.
-------------
PR Review Comment: https://git.openjdk.org/jfx/pull/986#discussion_r1167670033
PR Review Comment: https://git.openjdk.org/jfx/pull/986#discussion_r1167670688
More information about the openjfx-dev
mailing list