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 "stdafx.h" | 5 #include "stdafx.h" |
6 #include "win8/metro_driver/devices_handler.h" | 6 #include "win8/metro_driver/devices_handler.h" |
7 | 7 |
8 #include "base/logging.h" | 8 #include "base/logging.h" |
9 | 9 |
10 namespace metro_driver { | 10 namespace metro_driver { |
11 | 11 |
12 DevicesHandler::DevicesHandler() { | 12 DevicesHandler::DevicesHandler() { |
13 } | 13 } |
14 | 14 |
15 DevicesHandler::~DevicesHandler() { | 15 DevicesHandler::~DevicesHandler() { |
16 } | 16 } |
17 | 17 |
18 HRESULT DevicesHandler::Initialize(winui::Core::ICoreWindow* window) { | 18 HRESULT DevicesHandler::Initialize(winui::Core::ICoreWindow* window) { |
19 HRESULT hr = print_handler_.Initialize(window); | 19 HRESULT hr = print_handler_.Initialize(window); |
20 return hr; | 20 return hr; |
21 } | 21 } |
22 | 22 |
| 23 PointerEventHandler::PointerEventHandler() { |
| 24 } |
| 25 |
| 26 PointerEventHandler::~PointerEventHandler() { |
| 27 } |
| 28 |
| 29 HRESULT PointerEventHandler::Init(winui::Core::IPointerEventArgs* args) { |
| 30 mswr::ComPtr<winui::Input::IPointerPoint> pointer_point; |
| 31 HRESULT hr = args->get_CurrentPoint(&pointer_point); |
| 32 if (FAILED(hr)) |
| 33 return hr; |
| 34 |
| 35 mswr::ComPtr<windevs::Input::IPointerDevice> pointer_device; |
| 36 hr = pointer_point->get_PointerDevice(&pointer_device); |
| 37 if (FAILED(hr)) |
| 38 return hr; |
| 39 |
| 40 windevs::Input::PointerDeviceType device_type; |
| 41 hr = pointer_device->get_PointerDeviceType(&device_type); |
| 42 if (FAILED(hr)) |
| 43 return hr; |
| 44 |
| 45 is_mouse_ = (device_type == windevs::Input::PointerDeviceType_Mouse); |
| 46 winfoundtn::Point point; |
| 47 hr = pointer_point->get_Position(&point); |
| 48 if (FAILED(hr)) |
| 49 return hr; |
| 50 |
| 51 x_ = point.X; |
| 52 y_ = point.Y; |
| 53 return S_OK; |
| 54 } |
| 55 |
23 } // namespace metro_driver | 56 } // namespace metro_driver |
OLD | NEW |