Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h" | 5 #include "chrome/browser/ui/views/omnibox/omnibox_view_win.h" |
| 6 | 6 |
| 7 #include <algorithm> | 7 #include <algorithm> |
| 8 #include <locale> | 8 #include <locale> |
| 9 #include <string> | 9 #include <string> |
| 10 | 10 |
| (...skipping 1431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1442 break; | 1442 break; |
| 1443 default: | 1443 default: |
| 1444 break; | 1444 break; |
| 1445 } | 1445 } |
| 1446 return DefWindowProc(message, wparam, lparam); | 1446 return DefWindowProc(message, wparam, lparam); |
| 1447 } | 1447 } |
| 1448 | 1448 |
| 1449 LRESULT OmniboxViewWin::OnPointerDown(UINT message, | 1449 LRESULT OmniboxViewWin::OnPointerDown(UINT message, |
| 1450 WPARAM wparam, | 1450 WPARAM wparam, |
| 1451 LPARAM lparam) { | 1451 LPARAM lparam) { |
| 1452 if (!model()->has_focus()) | 1452 if (!model()->has_focus()) { |
| 1453 SetFocus(); | 1453 SetFocus(); |
| 1454 // The WM_POINTERDOWN message is received in Windows 8 mode when we touch | |
| 1455 // the window/click on it. There appears to be a bug in Windows 8 where in | |
| 1456 // the generated WM_LBUTTONDOWN/UP messages go to the window which | |
| 1457 // previously had focus. We set capture here to ensure that the generated | |
| 1458 // mouse messages come to us. | |
| 1459 SetCapture(); | |
| 1460 } | |
| 1454 | 1461 |
| 1455 if (IS_POINTER_FIRSTBUTTON_WPARAM(wparam)) { | 1462 if (IS_POINTER_FIRSTBUTTON_WPARAM(wparam)) { |
| 1456 TrackMousePosition(kLeft, CPoint(GET_X_LPARAM(lparam), | 1463 TrackMousePosition(kLeft, CPoint(GET_X_LPARAM(lparam), |
| 1457 GET_Y_LPARAM(lparam))); | 1464 GET_Y_LPARAM(lparam))); |
| 1458 } | 1465 } |
| 1459 | |
| 1460 SetMsgHandled(false); | 1466 SetMsgHandled(false); |
| 1461 | |
| 1462 return 0; | 1467 return 0; |
| 1463 } | 1468 } |
| 1464 | 1469 |
| 1465 LRESULT OmniboxViewWin::OnPointerUp(UINT message, WPARAM wparam, | 1470 LRESULT OmniboxViewWin::OnPointerUp(UINT message, WPARAM wparam, |
| 1466 LPARAM lparam) { | 1471 LPARAM lparam) { |
| 1467 SetMsgHandled(false); | 1472 SetMsgHandled(false); |
| 1468 | 1473 if (m_hWnd == GetCapture()) |
|
sky
2012/10/11 21:28:12
Is this invoked as you release each finger? If so,
ananta
2012/10/11 21:59:10
The only way to get info about touch points is to
| |
| 1474 ReleaseCapture(); | |
| 1469 return 0; | 1475 return 0; |
| 1470 } | 1476 } |
| 1471 | 1477 |
| 1472 void OmniboxViewWin::OnKeyDown(TCHAR key, | 1478 void OmniboxViewWin::OnKeyDown(TCHAR key, |
| 1473 UINT repeat_count, | 1479 UINT repeat_count, |
| 1474 UINT flags) { | 1480 UINT flags) { |
| 1475 delete_at_end_pressed_ = false; | 1481 delete_at_end_pressed_ = false; |
| 1476 | 1482 |
| 1477 if (OnKeyDownAllModes(key, repeat_count, flags)) | 1483 if (OnKeyDownAllModes(key, repeat_count, flags)) |
| 1478 return; | 1484 return; |
| (...skipping 1200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2679 return (rect.left - client_rect.left) + (client_rect.right - rect.right); | 2685 return (rect.left - client_rect.left) + (client_rect.right - rect.right); |
| 2680 } | 2686 } |
| 2681 | 2687 |
| 2682 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { | 2688 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { |
| 2683 // Use font_.GetStringWidth() instead of | 2689 // Use font_.GetStringWidth() instead of |
| 2684 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is | 2690 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is |
| 2685 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, | 2691 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, |
| 2686 // PosFromChar(i) might return 0 when i is greater than 1. | 2692 // PosFromChar(i) might return 0 when i is greater than 1. |
| 2687 return font_.GetStringWidth(text) + GetHorizontalMargin(); | 2693 return font_.GetStringWidth(text) + GetHorizontalMargin(); |
| 2688 } | 2694 } |
| OLD | NEW |