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

Unified Diff: ui/views/win/hwnd_message_handler.cc

Issue 22865036: Add support for reposting the ET_GESTURE_TAP_DOWN gesture event to the RootWindow and in the (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 7 years, 4 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
« ui/aura/root_window_unittest.cc ('K') | « ui/views/win/hwnd_message_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/win/hwnd_message_handler.cc
===================================================================
--- ui/views/win/hwnd_message_handler.cc (revision 218568)
+++ ui/views/win/hwnd_message_handler.cc (working copy)
@@ -393,7 +393,8 @@
paint_layered_window_factory_(this),
can_update_layered_window_(true),
is_first_nccalc_(true),
- autohide_factory_(this) {
+ autohide_factory_(this),
+ touch_event_factory_(this) {
}
HWNDMessageHandler::~HWNDMessageHandler() {
@@ -2041,11 +2042,17 @@
LRESULT HWNDMessageHandler::OnTouchEvent(UINT message,
WPARAM w_param,
LPARAM l_param) {
+ // Handle touch events only on Aura for now.
+#if !defined(USE_AURA)
+ SetMsgHandled(FALSE);
+ return 0;
+#endif
int num_points = LOWORD(w_param);
scoped_ptr<TOUCHINPUT[]> input(new TOUCHINPUT[num_points]);
if (ui::GetTouchInputInfoWrapper(reinterpret_cast<HTOUCHINPUT>(l_param),
num_points, input.get(),
sizeof(TOUCHINPUT))) {
+ TouchEvents touch_events;
for (int i = 0; i < num_points; ++i) {
ui::EventType touch_event_type = ui::ET_UNKNOWN;
@@ -2058,8 +2065,6 @@
} else if (input[i].dwFlags & TOUCHEVENTF_MOVE) {
touch_event_type = ui::ET_TOUCH_MOVED;
}
- // Handle touch events only on Aura for now.
-#if defined(USE_AURA)
if (touch_event_type != ui::ET_UNKNOWN) {
POINT point;
point.x = TOUCH_COORD_TO_PIXEL(input[i].x) /
@@ -2074,10 +2079,16 @@
gfx::Point(point.x, point.y),
input[i].dwID % ui::GestureSequence::kMaxGesturePoints,
base::TimeDelta::FromMilliseconds(input[i].dwTime));
- delegate_->HandleTouchEvent(event);
+ touch_events.push_back(event);
}
-#endif
}
+ // Handle the touch events asynchronously. We need this because touch
+ // events on windows don't fire if we enter a modal loop in the context of
+ // a touch event.
+ base::MessageLoop::current()->PostTask(
+ FROM_HERE,
+ base::Bind(&HWNDMessageHandler::HandleTouchEvents,
+ touch_event_factory_.GetWeakPtr(), touch_events));
}
CloseTouchInputHandle(reinterpret_cast<HTOUCHINPUT>(l_param));
SetMsgHandled(FALSE);
@@ -2181,4 +2192,11 @@
SetMsgHandled(FALSE);
}
+void HWNDMessageHandler::HandleTouchEvents(const TouchEvents& touch_events) {
+ if (!delegate_)
+ return;
+ for (size_t i = 0; i < touch_events.size(); ++i)
+ delegate_->HandleTouchEvent(touch_events[i]);
+}
+
} // namespace views
« ui/aura/root_window_unittest.cc ('K') | « ui/views/win/hwnd_message_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698