Changeset 25377 in webkit


Ignore:
Timestamp:
Sep 5, 2007, 4:02:38 PM (18 years ago)
Author:
hyatt
Message:

Fix ALT+key combos so that they go into the DOM.

Location:
trunk/WebKit/win
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/WebKit/win/ChangeLog

    r25362 r25377  
     12007-09-05  Dave Hyatt <hyatt@apple.com>
     2
     3        Make sure ALT+other keys is properly sent into the DOM so that Web pages (and editing fields) can
     4        detect key combos like ALT+Enter.
     5       
     6        Reviewed by Steve
     7
     8        * WebView.cpp:
     9        (WebView::keyUp):
     10        (WebView::keyDown):
     11        (WebViewWndProc):
     12        * WebView.h:
     13
    1142007-09-04  Sam Weinig  <sam@webkit.org>
    215
  • trunk/WebKit/win/WebView.cpp

    r25345 r25377  
    871871bool WebView::keyUp(WPARAM virtualKeyCode, LPARAM keyData)
    872872{
    873     // Don't send key events for shift, ctrl, and capslock keys when they're by themselves
    874     if (virtualKeyCode == VK_SHIFT || virtualKeyCode == VK_CONTROL || virtualKeyCode == VK_CAPITAL) {
     873    // Don't send key events for shift, ctrl, alt and capslock keys when they're by themselves
     874    if (virtualKeyCode == VK_SHIFT || virtualKeyCode == VK_CONTROL || virtualKeyCode == VK_MENU || virtualKeyCode == VK_CAPITAL)
    875875        return false;
    876     }
    877876
    878877    PlatformKeyboardEvent keyEvent(m_viewWindow, virtualKeyCode, keyData, m_currentCharacterCode);
     878
     879    // Don't send key events for alt+space.
     880    if (keyEvent.altKey() && virtualKeyCode == VK_SPACE)
     881        return false;
     882
    879883    Frame* frame = m_page->focusController()->focusedOrMainFrame();
    880884    m_currentCharacterCode = 0;
     
    10001004}
    10011005
    1002 bool WebView::keyDown(WPARAM virtualKeyCode, LPARAM keyData)
    1003 {
     1006bool WebView::keyDown(WPARAM virtualKeyCode, LPARAM keyData, bool systemKeyDown)
     1007{
     1008    // Don't send key events for shift, ctrl, alt and capslock keys when they're by themselves
     1009    if (virtualKeyCode == VK_SHIFT || virtualKeyCode == VK_CONTROL ||  virtualKeyCode == VK_MENU || virtualKeyCode == VK_CAPITAL)
     1010        return false;
     1011
     1012    // Don't send key events for alt+space, since the OS needs to handle that.
     1013    if (virtualKeyCode == VK_SPACE && systemKeyDown)
     1014        return false;
     1015
    10041016    MSG msg;
    10051017    // If the next message is a WM_CHAR message, then take it out of the queue, and use
    10061018    // the message parameters to get the character code to construct the PlatformKeyboardEvent.
    1007     if (::PeekMessage(&msg, m_viewWindow, WM_CHAR, WM_CHAR, PM_REMOVE))
     1019    if (systemKeyDown) {
     1020        if (::PeekMessage(&msg, m_viewWindow, WM_SYSCHAR, WM_SYSCHAR, PM_REMOVE))
     1021            m_currentCharacterCode = (UChar)msg.wParam;
     1022    } else if (::PeekMessage(&msg, m_viewWindow, WM_CHAR, WM_CHAR, PM_REMOVE))
    10081023        m_currentCharacterCode = (UChar)msg.wParam;
    10091024
    10101025    // FIXME: We need to check WM_UNICHAR to support supplementary characters.
    10111026    // FIXME: We may need to handle other messages for international text.
    1012 
    1013     // Don't send key events for shift, ctrl, and capslock keys when they're by themselves
    1014     if (virtualKeyCode == VK_SHIFT || virtualKeyCode == VK_CONTROL || virtualKeyCode == VK_CAPITAL)
    1015         return false;
    10161027
    10171028    m_inIMEKeyDown = virtualKeyCode == VK_PROCESSKEY;
     
    12031214                    handled = webView->mouseWheel(wParam, lParam, (wParam & MK_SHIFT) || message == WM_VISTA_MOUSEHWHEEL);
    12041215            break;
     1216        case WM_SYSKEYDOWN:
     1217            handled = webView->keyDown(wParam, lParam, true);
     1218            break;
    12051219        case WM_KEYDOWN:
    12061220            handled = webView->keyDown(wParam, lParam);
    12071221            break;
     1222        case WM_SYSKEYUP:
    12081223        case WM_KEYUP:
    12091224            handled = webView->keyUp(wParam, lParam);
  • trunk/WebKit/win/WebView.h

    r25345 r25377  
    623623    bool mouseWheel(WPARAM, LPARAM, bool isHorizontal);
    624624    bool execCommand(WPARAM wParam, LPARAM lParam);
    625     bool keyDown(WPARAM, LPARAM);
     625    bool keyDown(WPARAM, LPARAM, bool systemKeyDown = false);
    626626    bool keyUp(WPARAM, LPARAM);
    627627    HRESULT updateWebCoreSettingsFromPreferences(IWebPreferences* preferences);
Note: See TracChangeset for help on using the changeset viewer.