We want to add some ALT and F1 keyboard shortcuts but it seems like the chromium window is consuming them without passing them to the ::OnPreKeyEvent() event.
This works for control keys but not ALT - x, F1, F5:
- Code: Select all
bool ClientHandler::OnPreKeyEvent(CefRefPtr<CefBrowser> browser,
const CefKeyEvent& event, CefEventHandle os_event, bool* is_keyboard_shortcut) {
CEF_REQUIRE_UI_THREAD();
if (hAccelTable != NULL && os_event != NULL)
{
BOOL message_handled = TranslateAccelerator(mainframe_hwnd, hAccelTable, os_event);
if (message_handled)
{
LogTRACE0("CEF3 aceel table");
return true;
}
}
Are ALT and Fn keys supposed to be trappable and I'm doing something wrong? Or are the old threads from 2009-12 still correct and I either need to edit the chromium source or subclass the first child of the browser window like in this thread? - viewtopic.php?f=6&t=898&p=3577&hilit=pretranslatemessage#p3577
Edit: Placing a TranslateAccelerator() in the parent window (that has the browser object as a child) also works for trapping the CTRL hotkeys (but not ALT, Fn), though the one in OnPreKeyEvent() takes priority over it if both are enabled.