Skip to content

Commit

Permalink
Cherry-pick 278456@main (48d82b1). https://bugs.webkit.org/show_bug.c…
Browse files Browse the repository at this point in the history
…gi?id=273780

    [GTK] Consider keycode when activating application accelerators
    https://bugs.webkit.org/show_bug.cgi?id=273780

    Reviewed by Carlos Garcia Campos.

    Since Epiphany 46, keyboard shortcuts no longer work when using
    non-Latin keyboard layouts, like Ukranian or Hebrew. Currently we only
    consider the keyval when activating application accelerators. We need to
    consider the raw keycode as well. E.g. on a Hebrew keyboard pressing
    Ctrl+א should open a new tab, because the same key is used for both א
    and T.

    Fortunately, GTK can do the hard work of deciding which accelerator to
    activate for us. All we need to do is pass along the keycode.

    (This bug was *sort of* a regression from 273922@main. In practice, the
    regression probably only affected Epiphany, because this codepath only
    matters if the application allows the web view to process key events
    before it allows its GtkWindow to do so. That has to be done manually.
    Otherwise, this code will never be reached, because the GtkWindow would
    have already determined the key event matches an accelerator and handled
    it before the web view ever gets a chance to see it.)

    * Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp:
    (webkitWebViewBaseProcessAcceleratorsForKeyPressEvent):

    Canonical link: https://commits.webkit.org/278456@main

Canonical link: https://commits.webkit.org/274313.209@webkitglib/2.44
  • Loading branch information
mcatanzaro authored and aperezdc committed May 9, 2024
1 parent d43f02a commit 4821777
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion Source/WebKit/UIProcess/API/gtk/WebKitWebViewBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1315,7 +1315,7 @@ void webkitWebViewBaseProcessAcceleratorsForKeyPressEvent(WebKitWebViewBase* web
if (gdk_key_event_is_modifier(event))
return;

GUniquePtr<char> accelerator(gtk_accelerator_name(gdk_key_event_get_keyval(event), gdk_event_get_modifier_state(event)));
GUniquePtr<char> accelerator(gtk_accelerator_name_with_keycode(gtk_widget_get_display(GTK_WIDGET(webViewBase)), gdk_key_event_get_keyval(event), gdk_key_event_get_keycode(event), gdk_event_get_modifier_state(event)));
GUniquePtr<char*> actions(gtk_application_get_actions_for_accel(GTK_APPLICATION(app), accelerator.get()));
for (int i = 0; actions.get()[i]; ++i) {
const char* detailedAction = actions.get()[i];
Expand Down

0 comments on commit 4821777

Please sign in to comment.