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

Side by Side Diff: chrome/browser/ui/views/omnibox/omnibox_view_win.cc

Issue 12566007: Wrap calls to GetTouchInputInfo (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Created 7 years, 9 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 unified diff | Download patch
OLDNEW
1 // Copyright 2012 The Chromium Authors. All rights reserved. 1 // Copyright 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 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
56 #include "ui/base/dragdrop/os_exchange_data.h" 56 #include "ui/base/dragdrop/os_exchange_data.h"
57 #include "ui/base/dragdrop/os_exchange_data_provider_win.h" 57 #include "ui/base/dragdrop/os_exchange_data_provider_win.h"
58 #include "ui/base/events/event.h" 58 #include "ui/base/events/event.h"
59 #include "ui/base/events/event_constants.h" 59 #include "ui/base/events/event_constants.h"
60 #include "ui/base/ime/win/tsf_bridge.h" 60 #include "ui/base/ime/win/tsf_bridge.h"
61 #include "ui/base/ime/win/tsf_event_router.h" 61 #include "ui/base/ime/win/tsf_event_router.h"
62 #include "ui/base/keycodes/keyboard_codes.h" 62 #include "ui/base/keycodes/keyboard_codes.h"
63 #include "ui/base/l10n/l10n_util.h" 63 #include "ui/base/l10n/l10n_util.h"
64 #include "ui/base/l10n/l10n_util_win.h" 64 #include "ui/base/l10n/l10n_util_win.h"
65 #include "ui/base/win/mouse_wheel_util.h" 65 #include "ui/base/win/mouse_wheel_util.h"
66 #include "ui/base/win/touch_input.h"
66 #include "ui/gfx/canvas.h" 67 #include "ui/gfx/canvas.h"
67 #include "ui/gfx/image/image.h" 68 #include "ui/gfx/image/image.h"
68 #include "ui/views/button_drag_utils.h" 69 #include "ui/views/button_drag_utils.h"
69 #include "ui/views/controls/menu/menu_item_view.h" 70 #include "ui/views/controls/menu/menu_item_view.h"
70 #include "ui/views/controls/menu/menu_model_adapter.h" 71 #include "ui/views/controls/menu/menu_model_adapter.h"
71 #include "ui/views/controls/menu/menu_runner.h" 72 #include "ui/views/controls/menu/menu_runner.h"
72 #include "ui/views/controls/textfield/native_textfield_win.h" 73 #include "ui/views/controls/textfield/native_textfield_win.h"
73 #include "ui/views/widget/widget.h" 74 #include "ui/views/widget/widget.h"
74 #include "win8/util/win8_util.h" 75 #include "win8/util/win8_util.h"
75 76
(...skipping 1491 matching lines...) Expand 10 before | Expand all | Expand 10 after
1567 WPARAM wparam, 1568 WPARAM wparam,
1568 LPARAM lparam) { 1569 LPARAM lparam) {
1569 // There is a bug in Windows 8 where in the generated mouse messages 1570 // There is a bug in Windows 8 where in the generated mouse messages
1570 // after touch go to the window which previously had focus. This means that 1571 // after touch go to the window which previously had focus. This means that
1571 // if a user taps the omnibox to give it focus, we don't get the simulated 1572 // if a user taps the omnibox to give it focus, we don't get the simulated
1572 // WM_LBUTTONDOWN, and thus don't properly select all the text. To ensure 1573 // WM_LBUTTONDOWN, and thus don't properly select all the text. To ensure
1573 // that we get this message, we capture the mouse when the user is doing a 1574 // that we get this message, we capture the mouse when the user is doing a
1574 // single-point tap on an unfocused model. 1575 // single-point tap on an unfocused model.
1575 if ((wparam == 1) && !model()->has_focus()) { 1576 if ((wparam == 1) && !model()->has_focus()) {
1576 TOUCHINPUT point = {0}; 1577 TOUCHINPUT point = {0};
1577 if (GetTouchInputInfo(reinterpret_cast<HTOUCHINPUT>(lparam), 1, 1578 if (GetTouchInputInfoWrapper(reinterpret_cast<HTOUCHINPUT>(lparam), 1,
1578 &point, sizeof(TOUCHINPUT))) { 1579 &point, sizeof(TOUCHINPUT))) {
1579 if (point.dwFlags & TOUCHEVENTF_DOWN) 1580 if (point.dwFlags & TOUCHEVENTF_DOWN)
1580 SetCapture(); 1581 SetCapture();
1581 else if (point.dwFlags & TOUCHEVENTF_UP) 1582 else if (point.dwFlags & TOUCHEVENTF_UP)
1582 ReleaseCapture(); 1583 ReleaseCapture();
1583 } 1584 }
1584 } 1585 }
1585 SetMsgHandled(false); 1586 SetMsgHandled(false);
1586 return 0; 1587 return 0;
1587 } 1588 }
1588 1589
(...skipping 1253 matching lines...) Expand 10 before | Expand all | Expand 10 after
2842 return (rect.left - client_rect.left) + (client_rect.right - rect.right); 2843 return (rect.left - client_rect.left) + (client_rect.right - rect.right);
2843 } 2844 }
2844 2845
2845 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const { 2846 int OmniboxViewWin::WidthNeededToDisplay(const string16& text) const {
2846 // Use font_.GetStringWidth() instead of 2847 // Use font_.GetStringWidth() instead of
2847 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is 2848 // PosFromChar(location_entry_->GetTextLength()) because PosFromChar() is
2848 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout, 2849 // apparently buggy. In both LTR UI and RTL UI with left-to-right layout,
2849 // PosFromChar(i) might return 0 when i is greater than 1. 2850 // PosFromChar(i) might return 0 when i is greater than 1.
2850 return font_.GetStringWidth(text) + GetHorizontalMargin(); 2851 return font_.GetStringWidth(text) + GetHorizontalMargin();
2851 } 2852 }
OLDNEW
« no previous file with comments | « no previous file | content/browser/renderer_host/render_widget_host_view_win.cc » ('j') | ui/base/win/touch_input.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698