RESOLVED FIXED 221456
[GTK] event.ctrlKey and other are false in keydown event
https://bugs.webkit.org/show_bug.cgi?id=221456
Summary [GTK] event.ctrlKey and other are false in keydown event
Manuel Rego Casasnovas
Reported 2021-02-05 02:08:26 PST
Created attachment 419376 [details] Test case Check the attached example and type things like Ctrl or Alt. The event.ctrlKey or event.altKey will be false. This works fine on Mac and other browsers.
Attachments
Test case (443 bytes, text/html)
2021-02-05 02:08 PST, Manuel Rego Casasnovas
no flags
Patch (4.27 KB, patch)
2021-02-05 04:37 PST, Manuel Rego Casasnovas
no flags
Patch (8.81 KB, patch)
2021-02-05 07:30 PST, Manuel Rego Casasnovas
no flags
Patch (9.10 KB, patch)
2021-02-08 00:27 PST, Manuel Rego Casasnovas
no flags
Patch (8.90 KB, patch)
2021-02-08 00:36 PST, Manuel Rego Casasnovas
no flags
Manuel Rego Casasnovas
Comment 1 2021-02-05 04:37:22 PST
Adrian Perez
Comment 2 2021-02-05 07:02:21 PST
Comment on attachment 419387 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=419387&action=review > Source/WebKit/Shared/gtk/WebEventFactory.cpp:70 > + if (keyboardEvent) { When ”keyboardEvent” is true, the event type will always be “GDK_KEY_PRESS” or “GDK_KEY_RELEASE”; so instead of adding this ”keyboardEvent” flag to the function signature, I think we can directly check for “GDK_KEY_PRESS” instead: if (gdk_event_get_event_type(const_cast<GdkEvent*>(event)) == GDK_KEY_PRESS) { guint keyval; gdk_event_get_keyval(event, &keyval); switch (keyval) { // ... } } return modifiers; …or is there something else I am missing here? > Source/WebKit/Shared/gtk/WebEventFactory.cpp:340 > + Please remove this stray empty line before landing.
Manuel Rego Casasnovas
Comment 3 2021-02-05 07:30:57 PST
Manuel Rego Casasnovas
Comment 4 2021-02-05 07:49:42 PST
Comment on attachment 419387 [details] Patch View in context: https://bugs.webkit.org/attachment.cgi?id=419387&action=review >> Source/WebKit/Shared/gtk/WebEventFactory.cpp:70 >> + if (keyboardEvent) { > > When ”keyboardEvent” is true, the event type will always be “GDK_KEY_PRESS” or > “GDK_KEY_RELEASE”; so instead of adding this ”keyboardEvent” flag to the function > signature, I think we can directly check for “GDK_KEY_PRESS” instead: > > if (gdk_event_get_event_type(const_cast<GdkEvent*>(event)) == GDK_KEY_PRESS) { > guint keyval; > gdk_event_get_keyval(event, &keyval); > switch (keyval) { > // ... > } > } > > return modifiers; > > …or is there something else I am missing here? True thing, the first version of this method was not getting the event. I'll upload a new version doing that next week. Thanks for the review.
EWS Watchlist
Comment 5 2021-02-05 09:57:27 PST
Thanks for the patch. If this patch contains new public API please make sure it follows the guidelines for new WebKit2 GTK+ API. See https://trac.webkit.org/wiki/WebKitGTK/AddingNewWebKit2API
Manuel Rego Casasnovas
Comment 6 2021-02-08 00:27:41 PST
Manuel Rego Casasnovas
Comment 7 2021-02-08 00:36:40 PST
Manuel Rego Casasnovas
Comment 8 2021-02-08 00:37:15 PST
Applied the suggested changes and added a test. PTAL, thanks!
Adrian Perez
Comment 9 2021-02-08 03:31:48 PST
Comment on attachment 419561 [details] Patch Very nice that the patch comes now with a layout test, thanks for that!
EWS
Comment 10 2021-02-08 05:52:59 PST
Committed r272489: <https://commits.webkit.org/r272489> All reviewed patches have been landed. Closing bug and clearing flags on attachment 419561 [details].
Note You need to log in before you can comment on or make changes to this bug.