| 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 #include <string> | 11 #include <string> |
| 12 #include <utility> | 12 #include <utility> |
| 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/sys_info.h" | 19 #include "base/sys_info.h" |
| 20 #include "ui/aura/env.h" | 20 #include "ui/aura/env.h" |
| 21 #include "ui/aura/window.h" | 21 #include "ui/aura/window.h" |
| 22 #include "ui/aura/window_event_dispatcher.h" | 22 #include "ui/aura/window_event_dispatcher.h" |
| 23 #include "ui/base/x/x11_util.h" | 23 #include "ui/base/x/x11_util.h" |
| 24 #include "ui/display/screen.h" | 24 #include "ui/display/screen.h" |
| 25 #include "ui/display/types/display_constants.h" |
| 25 #include "ui/events/devices/device_data_manager.h" | 26 #include "ui/events/devices/device_data_manager.h" |
| 26 #include "ui/events/devices/x11/device_list_cache_x11.h" | 27 #include "ui/events/devices/x11/device_list_cache_x11.h" |
| 27 #include "ui/events/devices/x11/touch_factory_x11.h" | 28 #include "ui/events/devices/x11/touch_factory_x11.h" |
| 28 #include "ui/events/event.h" | 29 #include "ui/events/event.h" |
| 29 #include "ui/events/event_utils.h" | 30 #include "ui/events/event_utils.h" |
| 30 #include "ui/events/null_event_targeter.h" | 31 #include "ui/events/null_event_targeter.h" |
| 31 #include "ui/events/platform/platform_event_source.h" | 32 #include "ui/events/platform/platform_event_source.h" |
| 32 #include "ui/gfx/geometry/rect.h" | 33 #include "ui/gfx/geometry/rect.h" |
| 33 | 34 |
| 34 namespace ash { | 35 namespace ash { |
| (...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 case ui::ET_TOUCH_RELEASED: { | 187 case ui::ET_TOUCH_RELEASED: { |
| 187 #if defined(OS_CHROMEOS) | 188 #if defined(OS_CHROMEOS) |
| 188 XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(xev->xcookie.data); | 189 XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(xev->xcookie.data); |
| 189 int64_t touch_display_id = | 190 int64_t touch_display_id = |
| 190 ui::DeviceDataManager::GetInstance()->GetTargetDisplayForTouchDevice( | 191 ui::DeviceDataManager::GetInstance()->GetTargetDisplayForTouchDevice( |
| 191 xiev->deviceid); | 192 xiev->deviceid); |
| 192 // If we don't have record of display id for this touch device, check | 193 // If we don't have record of display id for this touch device, check |
| 193 // that if the event is within the bound of the root window. Note | 194 // that if the event is within the bound of the root window. Note |
| 194 // that in multi-monitor case, the event position is in framebuffer | 195 // that in multi-monitor case, the event position is in framebuffer |
| 195 // space so the bounds check will not work so well. | 196 // space so the bounds check will not work so well. |
| 196 if (touch_display_id == display::Display::kInvalidDisplayID) { | 197 if (touch_display_id == display::kInvalidDisplayId) { |
| 197 if (base::SysInfo::IsRunningOnChromeOS() && | 198 if (base::SysInfo::IsRunningOnChromeOS() && |
| 198 !bounds().Contains(ui::EventLocationFromNative(xev))) | 199 !bounds().Contains(ui::EventLocationFromNative(xev))) |
| 199 return false; | 200 return false; |
| 200 } else { | 201 } else { |
| 201 display::Screen* screen = display::Screen::GetScreen(); | 202 display::Screen* screen = display::Screen::GetScreen(); |
| 202 display::Display display = screen->GetDisplayNearestWindow(window()); | 203 display::Display display = screen->GetDisplayNearestWindow(window()); |
| 203 return touch_display_id == display.id(); | 204 return touch_display_id == display.id(); |
| 204 } | 205 } |
| 205 #endif // defined(OS_CHROMEOS) | 206 #endif // defined(OS_CHROMEOS) |
| 206 return true; | 207 return true; |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 249 continue; | 250 continue; |
| 250 XFree(data); | 251 XFree(data); |
| 251 XIChangeProperty(xdisplay(), dev_list[i].deviceid, prop, XA_INTEGER, 8, | 252 XIChangeProperty(xdisplay(), dev_list[i].deviceid, prop, XA_INTEGER, 8, |
| 252 PropModeReplace, &value, 1); | 253 PropModeReplace, &value, 1); |
| 253 } | 254 } |
| 254 } | 255 } |
| 255 } | 256 } |
| 256 #endif // defined(OS_CHROMEOS) | 257 #endif // defined(OS_CHROMEOS) |
| 257 | 258 |
| 258 } // namespace ash | 259 } // namespace ash |
| OLD | NEW |