Chromium Code Reviews| Index: chrome/browser/ui/views/omnibox/omnibox_view_win.cc |
| =================================================================== |
| --- chrome/browser/ui/views/omnibox/omnibox_view_win.cc (revision 160963) |
| +++ chrome/browser/ui/views/omnibox/omnibox_view_win.cc (working copy) |
| @@ -1371,6 +1371,11 @@ |
| // Enable TSF support of RichEdit. |
| SetEditStyle(SES_USECTF, SES_USECTF); |
| } |
| + |
| + if (base::win::GetVersion() >= base::win::VERSION_WIN8) { |
| + bool touch_mode = RegisterTouchWindow(m_hWnd, TWF_WANTPALM) == TRUE; |
|
Peter Kasting
2012/10/11 23:13:34
Nit: Just auto-convert to bool, don't explicitly c
ananta
2012/10/11 23:48:41
Replaced with !! as auto conversion gets a compile
Peter Kasting
2012/10/12 00:19:59
Suck. In that case, maybe it'd be even better to
|
| + DCHECK(touch_mode); |
| + } |
| SetMsgHandled(FALSE); |
| return 0; |
| } |
| @@ -1394,6 +1399,11 @@ |
| return 0; |
| } |
| +void OmniboxViewWin::OnDestroy() { |
| + if (base::win::GetVersion() >= base::win::VERSION_WIN8) |
| + UnregisterTouchWindow(m_hWnd); |
| +} |
| + |
| LRESULT OmniboxViewWin::OnImeComposition(UINT message, |
| WPARAM wparam, |
| LPARAM lparam) { |
| @@ -1446,6 +1456,26 @@ |
| return DefWindowProc(message, wparam, lparam); |
| } |
| +LRESULT OmniboxViewWin::OnTouchEvent(UINT message, |
| + WPARAM wparam, |
| + LPARAM lparam) { |
| + if (wparam == 1) { |
|
Peter Kasting
2012/10/11 23:13:34
Shouldn't this also check "&& !model()->has_focus(
ananta
2012/10/11 23:48:41
We can't do that as the WM_POINTERDOWN handler whi
ananta
2012/10/11 23:53:11
I moved the SetFocus call from OnPointerDown to th
|
| + TOUCHINPUT point = {0}; |
| + if (GetTouchInputInfo(reinterpret_cast<HTOUCHINPUT>(lparam), 1, |
| + &point, sizeof(TOUCHINPUT))) { |
| + // There is a bug in Windows 8 where in the generated mouse messages |
| + // after touch go to the window which previously had focus. We set |
| + // capture here to ensure that the generated mouse messages come to us. |
|
Peter Kasting
2012/10/11 23:13:34
Nit: If you move this comment to be at the beginni
ananta
2012/10/11 23:48:41
Done.
|
| + if (point.dwFlags & TOUCHEVENTF_DOWN) |
| + SetCapture(); |
| + else if (point.dwFlags & TOUCHEVENTF_UP) |
| + ReleaseCapture(); |
| + } |
| + } |
| + SetMsgHandled(false); |
| + return 0; |
| +} |
| + |
| LRESULT OmniboxViewWin::OnPointerDown(UINT message, |
| WPARAM wparam, |
| LPARAM lparam) { |
| @@ -1456,16 +1486,13 @@ |
| TrackMousePosition(kLeft, CPoint(GET_X_LPARAM(lparam), |
| GET_Y_LPARAM(lparam))); |
| } |
| - |
| SetMsgHandled(false); |
| - |
| return 0; |
| } |
| LRESULT OmniboxViewWin::OnPointerUp(UINT message, WPARAM wparam, |
| LPARAM lparam) { |
| SetMsgHandled(false); |
|
Peter Kasting
2012/10/11 23:13:34
Nit: If this is all this function does, can't we j
ananta
2012/10/11 23:48:41
Done.
|
| - |
| return 0; |
| } |