OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ash/host/ash_window_tree_host_x11.h" | 5 #include "ash/host/ash_window_tree_host_x11.h" |
6 | 6 |
7 #include <X11/extensions/Xfixes.h> | 7 #include <X11/extensions/Xfixes.h> |
8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
9 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> |
10 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
11 | 11 |
12 #include <string> | 12 #include <string> |
13 #include <vector> | 13 #include <vector> |
14 | 14 |
15 #include "ash/host/ash_window_tree_host_init_params.h" | 15 #include "ash/host/ash_window_tree_host_init_params.h" |
16 #include "ash/host/ash_window_tree_host_unified.h" | 16 #include "ash/host/ash_window_tree_host_unified.h" |
17 #include "ash/host/root_window_transformer.h" | 17 #include "ash/host/root_window_transformer.h" |
18 #include "ash/ime/input_method_event_handler.h" | 18 #include "ash/ime/input_method_event_handler.h" |
19 #include "base/basictypes.h" | |
20 #include "base/sys_info.h" | 19 #include "base/sys_info.h" |
21 #include "ui/aura/env.h" | 20 #include "ui/aura/env.h" |
22 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
23 #include "ui/aura/window_event_dispatcher.h" | 22 #include "ui/aura/window_event_dispatcher.h" |
24 #include "ui/base/x/x11_util.h" | 23 #include "ui/base/x/x11_util.h" |
25 #include "ui/events/devices/device_data_manager.h" | 24 #include "ui/events/devices/device_data_manager.h" |
26 #include "ui/events/devices/x11/device_list_cache_x11.h" | 25 #include "ui/events/devices/x11/device_list_cache_x11.h" |
27 #include "ui/events/devices/x11/touch_factory_x11.h" | 26 #include "ui/events/devices/x11/touch_factory_x11.h" |
28 #include "ui/events/event.h" | 27 #include "ui/events/event.h" |
29 #include "ui/events/event_utils.h" | 28 #include "ui/events/event_utils.h" |
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
200 ui::EventType type = ui::EventTypeFromNative(xev); | 199 ui::EventType type = ui::EventTypeFromNative(xev); |
201 // For touch event, check if the root window is residing on the according | 200 // For touch event, check if the root window is residing on the according |
202 // touch display. | 201 // touch display. |
203 switch (type) { | 202 switch (type) { |
204 case ui::ET_TOUCH_MOVED: | 203 case ui::ET_TOUCH_MOVED: |
205 case ui::ET_TOUCH_PRESSED: | 204 case ui::ET_TOUCH_PRESSED: |
206 case ui::ET_TOUCH_CANCELLED: | 205 case ui::ET_TOUCH_CANCELLED: |
207 case ui::ET_TOUCH_RELEASED: { | 206 case ui::ET_TOUCH_RELEASED: { |
208 #if defined(OS_CHROMEOS) | 207 #if defined(OS_CHROMEOS) |
209 XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(xev->xcookie.data); | 208 XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(xev->xcookie.data); |
210 int64 touch_display_id = | 209 int64_t touch_display_id = |
211 ui::DeviceDataManager::GetInstance()->GetTargetDisplayForTouchDevice( | 210 ui::DeviceDataManager::GetInstance()->GetTargetDisplayForTouchDevice( |
212 xiev->deviceid); | 211 xiev->deviceid); |
213 // If we don't have record of display id for this touch device, check | 212 // If we don't have record of display id for this touch device, check |
214 // that if the event is within the bound of the root window. Note | 213 // that if the event is within the bound of the root window. Note |
215 // that in multi-monitor case, the event position is in framebuffer | 214 // that in multi-monitor case, the event position is in framebuffer |
216 // space so the bounds check will not work so well. | 215 // space so the bounds check will not work so well. |
217 if (touch_display_id == gfx::Display::kInvalidDisplayID) { | 216 if (touch_display_id == gfx::Display::kInvalidDisplayID) { |
218 if (base::SysInfo::IsRunningOnChromeOS() && | 217 if (base::SysInfo::IsRunningOnChromeOS() && |
219 !bounds().Contains(ui::EventLocationFromNative(xev))) | 218 !bounds().Contains(ui::EventLocationFromNative(xev))) |
220 return false; | 219 return false; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
292 #endif | 291 #endif |
293 | 292 |
294 AshWindowTreeHost* AshWindowTreeHost::Create( | 293 AshWindowTreeHost* AshWindowTreeHost::Create( |
295 const AshWindowTreeHostInitParams& init_params) { | 294 const AshWindowTreeHostInitParams& init_params) { |
296 if (init_params.offscreen) | 295 if (init_params.offscreen) |
297 return new AshWindowTreeHostUnified(init_params.initial_bounds); | 296 return new AshWindowTreeHostUnified(init_params.initial_bounds); |
298 return new AshWindowTreeHostX11(init_params.initial_bounds); | 297 return new AshWindowTreeHostX11(init_params.initial_bounds); |
299 } | 298 } |
300 | 299 |
301 } // namespace ash | 300 } // namespace ash |
OLD | NEW |