2006-03-14 Eric Seidel <eseidel@apple.com>
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Mar 2006 10:33:50 +0000 (10:33 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 14 Mar 2006 10:33:50 +0000 (10:33 +0000)
        Reviewed by mjs.

        Fix WebView to allow KeyFocus.
        Add handling of space and shift-space for scrolling.

        * Spinneret/Spinneret/WebView.cpp:
        (WebKit::scrollMessageForKey):
        (WebKit::WebViewWndProc):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@13284 268f45cc-cd09-0410-ab3c-d52691b4dbfc

WebKitTools/ChangeLog
WebKitTools/Spinneret/Spinneret/WebView.cpp

index a3e9fa0451e2094fa280f89d6d9c6678d5401f56..6ec73b22df6c4025d41985ce5a0ddfd598c17e2a 100644 (file)
@@ -1,3 +1,14 @@
+2006-03-14  Eric Seidel  <eseidel@apple.com>
+
+        Reviewed by mjs.
+
+        Fix WebView to allow KeyFocus.
+        Add handling of space and shift-space for scrolling.
+
+        * Spinneret/Spinneret/WebView.cpp:
+        (WebKit::scrollMessageForKey):
+        (WebKit::WebViewWndProc):
+
 2006-03-10  Eric Seidel  <eseidel@apple.com>
 
         Reviewed by hyatt.
index 8d05951afea20ed2769af4c13ad18544670fb902..ca87e29240993b551970997c8290606fe83ca5c7 100755 (executable)
@@ -179,6 +179,8 @@ static int scrollMessageForKey(WPARAM keyCode)
         return SB_TOP;
     case VK_END:
         return SB_BOTTOM;
+    case VK_SPACE:
+        return (GetKeyState(VK_SHIFT) & 0x8000) ? SB_PAGEUP : SB_PAGEDOWN;
     }
     return -1;
 }
@@ -199,6 +201,11 @@ LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
         webview->mouseMoved(hWnd, wParam, lParam);
         break;
     case WM_LBUTTONDOWN:
+        // Make ourselves the focused window before doing anything else
+        // FIXME: I'm not sure if this is the "right" way to do this
+        // but w/o this call, we never become focused since we don't allow
+        // the default handling of mouse events.
+        SetFocus(hWnd);
     case WM_MBUTTONDOWN:
     case WM_RBUTTONDOWN:
         webview->mouseDown(hWnd, wParam, lParam);
@@ -224,6 +231,10 @@ LRESULT CALLBACK WebViewWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM l
         break;
     }
     case WM_KEYDOWN: {
+        // FIXME: First we should send key events up through the DOM
+        // to form controls, etc.  If they are not handled, we fall
+        // through to the top level webview and do things like scrolling
+
         WORD wScrollNotify = scrollMessageForKey(wParam);
         if (wScrollNotify != -1)
             SendMessage(hWnd, WM_VSCROLL, MAKELONG(wScrollNotify, 0), 0L);