OLD | NEW |
---|---|
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/base/touch/touch_device.h" | 5 #include "ui/base/touch/touch_device.h" |
6 | 6 |
7 #include "base/logging.h" | 7 #include "base/logging.h" |
8 #include "ui/events/devices/device_data_manager.h" | 8 #include "ui/events/devices/device_data_manager.h" |
9 #include "ui/events/devices/x11/touch_factory_x11.h" | 9 #include "ui/events/devices/x11/touch_factory_x11.h" |
10 | 10 |
11 namespace ui { | 11 namespace ui { |
12 | 12 |
13 bool IsTouchDevicePresent() { | 13 bool IsTouchDevicePresent() { |
14 // TODO(sadrul@chromium.org): Support evdev hotplugging. | |
14 return ui::DeviceDataManager::GetInstance()->touchscreen_devices().size() > 0; | 15 return ui::DeviceDataManager::GetInstance()->touchscreen_devices().size() > 0; |
15 } | 16 } |
16 | 17 |
17 int MaxTouchPoints() { | 18 int MaxTouchPoints() { |
18 return ui::TouchFactory::GetInstance()->GetMaxTouchPoints(); | 19 return ui::TouchFactory::GetInstance()->GetMaxTouchPoints(); |
sadrul
2014/12/19 21:48:44
I think this is X11 only, and isn't available on o
| |
19 } | 20 } |
20 | 21 |
21 // TODO(mustaq@chromium.org): Use mouse detection logic. crbug.com/440503 | 22 // TODO(mustaq@chromium.org): Use mouse detection logic. crbug.com/440503 |
22 int GetAvailablePointerTypes() { | 23 int GetAvailablePointerTypes() { |
23 // Assume a mouse is there | 24 // Assume a mouse is there |
24 int available_pointer_types = POINTER_TYPE_FINE; | 25 int available_pointer_types = POINTER_TYPE_FINE; |
25 if (IsTouchDevicePresent()) | 26 if (IsTouchDevicePresent()) |
26 available_pointer_types |= POINTER_TYPE_COARSE; | 27 available_pointer_types |= POINTER_TYPE_COARSE; |
27 | 28 |
28 DCHECK(available_pointer_types); | 29 DCHECK(available_pointer_types); |
(...skipping 25 matching lines...) Expand all Loading... | |
54 int available_hover_types = GetAvailableHoverTypes(); | 55 int available_hover_types = GetAvailableHoverTypes(); |
55 if (available_hover_types & HOVER_TYPE_HOVER) | 56 if (available_hover_types & HOVER_TYPE_HOVER) |
56 return HOVER_TYPE_HOVER; | 57 return HOVER_TYPE_HOVER; |
57 if (available_hover_types & HOVER_TYPE_ON_DEMAND) | 58 if (available_hover_types & HOVER_TYPE_ON_DEMAND) |
58 return HOVER_TYPE_ON_DEMAND; | 59 return HOVER_TYPE_ON_DEMAND; |
59 DCHECK_EQ(available_hover_types, HOVER_TYPE_NONE); | 60 DCHECK_EQ(available_hover_types, HOVER_TYPE_NONE); |
60 return HOVER_TYPE_NONE; | 61 return HOVER_TYPE_NONE; |
61 } | 62 } |
62 | 63 |
63 } // namespace ui | 64 } // namespace ui |
OLD | NEW |