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

Side by Side Diff: chrome/browser/renderer_host/render_widget_host_view_views.cc

Issue 6323010: touch: Filter touch events. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 9 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/renderer_host/render_widget_host_view_views.h" 5 #include "chrome/browser/renderer_host/render_widget_host_view_views.h"
6 6
7 #include <algorithm> 7 #include <algorithm>
8 #include <string> 8 #include <string>
9 9
10 #include "app/l10n_util.h" 10 #include "app/l10n_util.h"
(...skipping 699 matching lines...) Expand 10 before | Expand all | Expand 10 after
710 break; 710 break;
711 } 711 }
712 712
713 if (!point) 713 if (!point)
714 return TOUCH_STATUS_UNKNOWN; 714 return TOUCH_STATUS_UNKNOWN;
715 715
716 if (status != TOUCH_STATUS_START) 716 if (status != TOUCH_STATUS_START)
717 status = TOUCH_STATUS_CONTINUE; 717 status = TOUCH_STATUS_CONTINUE;
718 718
719 // Update the location and state of the point. 719 // Update the location and state of the point.
720 point->state = TouchPointStateFromEvent(&e);
721 if (point->state == WebKit::WebTouchPoint::StateMoved) {
722 // It is possible for badly written touch drivers to emit Move events even
723 // when the touch location hasn't changed. In such cases, consume the event
724 // and pretend nothing happened.
725 if (point->position.x == e.x() && point->position.y == e.y()) {
726 return status;
727 }
728 }
720 UpdateTouchPointPosition(&e, GetPosition(), point); 729 UpdateTouchPointPosition(&e, GetPosition(), point);
721 point->state = TouchPointStateFromEvent(&e);
722 730
723 // Mark the rest of the points as stationary. 731 // Mark the rest of the points as stationary.
724 for (int i = 0; i < touch_event_.touchPointsLength; ++i) { 732 for (int i = 0; i < touch_event_.touchPointsLength; ++i) {
725 WebKit::WebTouchPoint* iter = touch_event_.touchPoints + i; 733 WebKit::WebTouchPoint* iter = touch_event_.touchPoints + i;
726 if (iter != point) { 734 if (iter != point) {
727 iter->state = WebKit::WebTouchPoint::StateStationary; 735 iter->state = WebKit::WebTouchPoint::StateStationary;
728 } 736 }
729 } 737 }
730 738
731 // Update the type of the touch event. 739 // Update the type of the touch event.
(...skipping 21 matching lines...) Expand all
753 } 761 }
754 762
755 // static 763 // static
756 RenderWidgetHostView* 764 RenderWidgetHostView*
757 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView( 765 RenderWidgetHostView::GetRenderWidgetHostViewFromNativeView(
758 gfx::NativeView widget) { 766 gfx::NativeView widget) {
759 gpointer user_data = g_object_get_data(G_OBJECT(widget), 767 gpointer user_data = g_object_get_data(G_OBJECT(widget),
760 kRenderWidgetHostViewKey); 768 kRenderWidgetHostViewKey);
761 return reinterpret_cast<RenderWidgetHostView*>(user_data); 769 return reinterpret_cast<RenderWidgetHostView*>(user_data);
762 } 770 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698