| 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 "ui/views/win/hwnd_message_handler.h" | 5 #include "ui/views/win/hwnd_message_handler.h" |
| 6 | 6 |
| 7 #include <dwmapi.h> | 7 #include <dwmapi.h> |
| 8 #include <oleacc.h> | 8 #include <oleacc.h> |
| 9 #include <shellapi.h> | 9 #include <shellapi.h> |
| 10 #include <wtsapi32.h> | 10 #include <wtsapi32.h> |
| (...skipping 2452 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2463 base::Bind(&HWNDMessageHandler::ResetTouchDownContext, | 2463 base::Bind(&HWNDMessageHandler::ResetTouchDownContext, |
| 2464 weak_factory_.GetWeakPtr()), | 2464 weak_factory_.GetWeakPtr()), |
| 2465 base::TimeDelta::FromMilliseconds(kTouchDownContextResetTimeout)); | 2465 base::TimeDelta::FromMilliseconds(kTouchDownContextResetTimeout)); |
| 2466 } else if (input[i].dwFlags & TOUCHEVENTF_UP) { | 2466 } else if (input[i].dwFlags & TOUCHEVENTF_UP) { |
| 2467 touch_ids_.erase(input[i].dwID); | 2467 touch_ids_.erase(input[i].dwID); |
| 2468 touch_event_type = ui::ET_TOUCH_RELEASED; | 2468 touch_event_type = ui::ET_TOUCH_RELEASED; |
| 2469 } else if (input[i].dwFlags & TOUCHEVENTF_MOVE) { | 2469 } else if (input[i].dwFlags & TOUCHEVENTF_MOVE) { |
| 2470 touch_event_type = ui::ET_TOUCH_MOVED; | 2470 touch_event_type = ui::ET_TOUCH_MOVED; |
| 2471 } | 2471 } |
| 2472 if (touch_event_type != ui::ET_UNKNOWN) { | 2472 if (touch_event_type != ui::ET_UNKNOWN) { |
| 2473 base::TimeTicks now; | |
| 2474 // input[i].dwTime doesn't necessarily relate to the system time at all, | 2473 // input[i].dwTime doesn't necessarily relate to the system time at all, |
| 2475 // so use base::TimeTicks::HighResNow() if possible, or | 2474 // so use base::TimeTicks::Now() |
| 2476 // base::TimeTicks::Now() otherwise. | 2475 const base::TimeTicks now = base::TimeTicks::Now(); |
| 2477 if (base::TimeTicks::IsHighResNowFastAndReliable()) | |
| 2478 now = base::TimeTicks::HighResNow(); | |
| 2479 else | |
| 2480 now = base::TimeTicks::Now(); | |
| 2481 ui::TouchEvent event(touch_event_type, | 2476 ui::TouchEvent event(touch_event_type, |
| 2482 gfx::Point(point.x, point.y), | 2477 gfx::Point(point.x, point.y), |
| 2483 id_generator_.GetGeneratedID(input[i].dwID), | 2478 id_generator_.GetGeneratedID(input[i].dwID), |
| 2484 now - base::TimeTicks()); | 2479 now - base::TimeTicks()); |
| 2485 event.set_flags(flags); | 2480 event.set_flags(flags); |
| 2486 event.latency()->AddLatencyNumberWithTimestamp( | 2481 event.latency()->AddLatencyNumberWithTimestamp( |
| 2487 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, | 2482 ui::INPUT_EVENT_LATENCY_ORIGINAL_COMPONENT, |
| 2488 0, | 2483 0, |
| 2489 0, | 2484 0, |
| 2490 base::TimeTicks::FromInternalValue( | 2485 base::TimeTicks::FromInternalValue( |
| (...skipping 349 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2840 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); | 2835 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_HIDEWINDOW); |
| 2841 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); | 2836 SetWindowPos(hwnd(), NULL, 0, 0, 0, 0, flags | SWP_SHOWWINDOW); |
| 2842 } | 2837 } |
| 2843 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want | 2838 // WM_DWMCOMPOSITIONCHANGED is only sent to top level windows, however we want |
| 2844 // to notify our children too, since we can have MDI child windows who need to | 2839 // to notify our children too, since we can have MDI child windows who need to |
| 2845 // update their appearance. | 2840 // update their appearance. |
| 2846 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); | 2841 EnumChildWindows(hwnd(), &SendDwmCompositionChanged, NULL); |
| 2847 } | 2842 } |
| 2848 | 2843 |
| 2849 } // namespace views | 2844 } // namespace views |
| OLD | NEW |