RESOLVED FIXED 207250
[Win][MiniBrowser] Accelerator keys don't work unless the main window is focused
https://bugs.webkit.org/show_bug.cgi?id=207250
Summary [Win][MiniBrowser] Accelerator keys don't work unless the main window is focused
Fujii Hironori
Reported 2020-02-04 23:06:35 PST
[Win][MiniBrowser] Accelerator keys don't work unless the main window is focused MiniBrowser has accelerator keys, Ctrl-W to close window, Ctrl-R to reload. In Firefox and Chrome, Ctrl-R can be prevented, but Ctrl-W can't. Reloading by Ctrl-R should be implemented in WebKitBrowserWindow::didNotHandleKeyEvent. You can test it by using https://javascript.info/keyboard-events I think TranslateAccelerator should be used only for the message for main window. https://stackoverflow.com/a/20138696
Attachments
WIP patch (2.92 KB, patch)
2020-02-04 23:07 PST, Fujii Hironori
no flags
WIP patch (6.57 KB, patch)
2020-02-05 03:25 PST, Fujii Hironori
no flags
Patch (11.59 KB, patch)
2020-02-05 22:13 PST, Fujii Hironori
no flags
Fujii Hironori
Comment 1 2020-02-04 23:07:24 PST
Created attachment 389774 [details] WIP patch
Fujii Hironori
Comment 2 2020-02-04 23:40:13 PST
I realized two problems in this WIP patch. 1. Ctrl-W can't close the window while loading a page Ctrl-W should be processed without dispatching to WebKit. 2. accelerator keys don't work if toolbar buttons or URL bar are focused. toolbar buttons should give up WM_SETFOCUS. https://stackoverflow.com/a/18540038
Fujii Hironori
Comment 3 2020-02-05 00:23:10 PST
3. By pressing Alt-Tab to switch active windows, the main window gets focused. This is the only way to focus the main window at the moment, but this seems a bug. For example, Windows File Explore restores the previous focus when re-activating. Restoring the previous focus seems a application's task by using WM_ACTIVATE.
Fujii Hironori
Comment 4 2020-02-05 00:29:32 PST
4. Ctrl++ (zoom in) and Ctrl+- (zoom out) is effective only for numpad
Fujii Hironori
Comment 5 2020-02-05 02:29:06 PST
To solve the issue #1, it seems that I should add WM_COMMAND bubble up code in WebView. > case WM_COMMAND: > PostMessage(GetParent(hWnd), message, wParam, lParam); https://stackoverflow.com/a/1963016
Fujii Hironori
Comment 6 2020-02-05 03:25:33 PST
Created attachment 389789 [details] WIP patch * Split the accelerator table into pre and post. * WebKit2 WebView bubbles up WM_COMMAND message to the parent * SetFocus the brower window when WM_ACTIVATE of the main window issue#2 and issue#4 still remain Ctrl+R doesn't work for WebKit1 because it doesn't have didNotHandleKeyEvent Ctrl+W doesn't work for WebKit1 because I din'd add the code bubbling up WM_COMMAND. Shold I add it to WebKit1?
Fujii Hironori
Comment 7 2020-02-05 22:13:38 PST
Fujii Hironori
Comment 8 2020-02-06 17:42:28 PST
Comment on attachment 389937 [details] Patch Clearing flags on attachment: 389937 Committed r255995: <https://trac.webkit.org/changeset/255995>
Fujii Hironori
Comment 9 2020-02-06 17:42:31 PST
All reviewed patches have been landed. Closing bug.
Radar WebKit Bug Importer
Comment 10 2020-02-06 17:43:14 PST
Note You need to log in before you can comment on or make changes to this bug.