| Index: ui/views/win/hwnd_message_handler.h
|
| diff --git a/ui/views/win/hwnd_message_handler.h b/ui/views/win/hwnd_message_handler.h
|
| index d2dc968b22a0579db935bc02d2d7e51c91f860cd..004fb880a469a4d50780e2f6798b0d1697a167eb 100644
|
| --- a/ui/views/win/hwnd_message_handler.h
|
| +++ b/ui/views/win/hwnd_message_handler.h
|
| @@ -7,7 +7,7 @@
|
|
|
| #include <windows.h>
|
|
|
| -#include <set>
|
| +#include <array>
|
| #include <vector>
|
|
|
| #include "base/basictypes.h"
|
| @@ -21,6 +21,7 @@
|
| #include "ui/base/ui_base_types.h"
|
| #include "ui/base/win/window_event_target.h"
|
| #include "ui/events/event.h"
|
| +#include "ui/events/gesture_detection/motion_event.h"
|
| #include "ui/gfx/geometry/rect.h"
|
| #include "ui/gfx/sequential_id_generator.h"
|
| #include "ui/gfx/win/window_impl.h"
|
| @@ -208,7 +209,27 @@ class VIEWS_EXPORT HWNDMessageHandler :
|
| void SizeConstraintsChanged();
|
|
|
| private:
|
| - typedef std::set<DWORD> TouchIDs;
|
| + FRIEND_TEST_ALL_PREFIXES(HWNDMessageHandler, TestCorrectTouchInputList);
|
| + FRIEND_TEST_ALL_PREFIXES(HWNDMessageHandler, TestMissingTouchRelease);
|
| + FRIEND_TEST_ALL_PREFIXES(HWNDMessageHandler, TestMissingTouchPress);
|
| + FRIEND_TEST_ALL_PREFIXES(HWNDMessageHandler, TestMissingTouchPressAndRelease);
|
| +
|
| + // We use InTouchList self-defined type to specify if the touch point from
|
| + // last message is in the current message or not.
|
| + enum class InTouchList { NotPresent, InPreviousMessage, InCurrentMessage };
|
| +
|
| + // We need the touch location to release a touch point which is not in the
|
| + // current message.
|
| + struct TouchPoint {
|
| + gfx::Point location;
|
| + InTouchList in_touch_list;
|
| +
|
| + TouchPoint() : in_touch_list(InTouchList::NotPresent) {}
|
| + };
|
| +
|
| + using TouchEvents = std::vector<ui::TouchEvent>;
|
| + using TouchPointArray =
|
| + std::array<TouchPoint, ui::MotionEvent::MAX_TOUCH_POINT_COUNT>;
|
|
|
| // Overridden from internal::InputMethodDelegate:
|
| void DispatchKeyEventPostIME(const ui::KeyEvent& key) override;
|
| @@ -458,7 +479,6 @@ class VIEWS_EXPORT HWNDMessageHandler :
|
| void OnWindowPosChanging(WINDOWPOS* window_pos);
|
| void OnWindowPosChanged(WINDOWPOS* window_pos);
|
|
|
| - typedef std::vector<ui::TouchEvent> TouchEvents;
|
| // Helper to handle the list of touch events passed in. We need this because
|
| // touch events on windows don't fire if we enter a modal loop in the context
|
| // of a touch event.
|
| @@ -466,7 +486,7 @@ class VIEWS_EXPORT HWNDMessageHandler :
|
|
|
| // Resets the flag which indicates that we are in the context of a touch down
|
| // event.
|
| - void ResetTouchDownContext();
|
| + void DecrementTouchDownContext(int decrement);
|
|
|
| // Helper to handle mouse events.
|
| // The |message|, |w_param|, |l_param| parameters identify the Windows mouse
|
| @@ -489,6 +509,23 @@ class VIEWS_EXPORT HWNDMessageHandler :
|
| // Provides functionality to transition a frame to DWM.
|
| void PerformDwmTransition();
|
|
|
| + void PrepareTouchEventList(TOUCHINPUT input[],
|
| + int num_points,
|
| + TouchEvents* touch_events);
|
| +
|
| + // From one WM_TOUCH message, we will generate corresponding touch events.
|
| + void GenerateTouchEvent(DWORD input_dwID,
|
| + const gfx::Point& point_location,
|
| + ui::EventType touch_event_type,
|
| + TouchEvents* touch_events);
|
| +
|
| + // It will release the touch points which are no longer in the current message
|
| + // because the messages are sent inconsistently, and also set the touch points
|
| + // we have seen in the current message to be InPreviousMessage.
|
| + void UpdateTouchPointStates(TouchEvents* touch_events);
|
| +
|
| + const TouchPointArray& touch_id_list() const { return touch_id_list_; }
|
| +
|
| HWNDMessageHandlerDelegate* delegate_;
|
|
|
| scoped_ptr<FullscreenHandler> fullscreen_handler_;
|
| @@ -522,9 +559,6 @@ class VIEWS_EXPORT HWNDMessageHandler :
|
| // area. We need this so we can correctly show the context menu on mouse-up.
|
| bool is_right_mouse_pressed_on_caption_;
|
|
|
| - // The set of touch devices currently down.
|
| - TouchIDs touch_ids_;
|
| -
|
| // ScopedRedrawLock ----------------------------------------------------------
|
|
|
| // Represents the number of ScopedRedrawLocks active against this widget.
|
| @@ -623,6 +657,16 @@ class VIEWS_EXPORT HWNDMessageHandler :
|
| // glass. Defaults to false.
|
| bool dwm_transition_desired_;
|
|
|
| + // The WM_TOUCH message at times sends inconsistent number of touch pointers,
|
| + // so we keep the IDs of touch pointers we have seen from last message, and
|
| + // compare with the current message in order to release the ones which are not
|
| + // in the current list, or send a touchpress when we see a new touch point.
|
| + // The index of the array is the touch_ID.
|
| + TouchPointArray touch_id_list_;
|
| +
|
| + // Keep the count of the current active touch points.
|
| + int active_touch_point_count_;
|
| +
|
| // A factory used to lookup appbar autohide edges.
|
| base::WeakPtrFactory<HWNDMessageHandler> autohide_factory_;
|
|
|
|
|