Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(6825)

Unified Diff: chrome/browser/ui/views/omnibox/omnibox_view_win.cc

Issue 11098077: Grab mouse capture in the WM_POINTERDOWN message handler in the omnibox. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_win.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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);
+ 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,29 +1456,42 @@
return DefWindowProc(message, wparam, lparam);
}
+LRESULT OmniboxViewWin::OnTouchEvent(UINT message,
+ WPARAM wparam,
+ LPARAM lparam) {
+ // There is a bug in Windows 8 where in the generated mouse messages
+ // after touch go to the window which previously had focus. This means that
+ // if a user taps the omnibox to give it focus, we don't get the simulated
+ // WM_LBUTTONDOWN, and thus don't properly select all the text. To ensure
+ // that we get this message, we capture the mouse when the user is doing a
Peter Kasting 2012/10/12 00:19:59 Nit: Extra space
ananta 2012/10/12 00:37:18 Done.
+ // single-point tap on an unfocused model.
+ if (wparam == 1 && !model()->has_focus()) {
Peter Kasting 2012/10/12 00:19:59 Nit: Rest of this code puts parens around all bina
ananta 2012/10/12 00:37:18 Do you mean to parenthesize point.dwFlags & TOUCHE
+ TOUCHINPUT point = {0};
+ if (GetTouchInputInfo(reinterpret_cast<HTOUCHINPUT>(lparam), 1,
+ &point, sizeof(TOUCHINPUT))) {
+ if (point.dwFlags & TOUCHEVENTF_DOWN) {
+ SetFocus();
+ SetCapture();
+ } else if (point.dwFlags & TOUCHEVENTF_UP) {
+ ReleaseCapture();
+ }
+ }
+ }
+ SetMsgHandled(false);
+ return 0;
+}
+
LRESULT OmniboxViewWin::OnPointerDown(UINT message,
WPARAM wparam,
LPARAM lparam) {
- if (!model()->has_focus())
- SetFocus();
-
if (IS_POINTER_FIRSTBUTTON_WPARAM(wparam)) {
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);
-
- return 0;
-}
-
void OmniboxViewWin::OnKeyDown(TCHAR key,
UINT repeat_count,
UINT flags) {
« no previous file with comments | « chrome/browser/ui/views/omnibox/omnibox_view_win.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698