| 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> |
| 8 #include <X11/extensions/XInput2.h> |
| 7 #include <X11/Xatom.h> | 9 #include <X11/Xatom.h> |
| 8 #include <X11/Xlib.h> | 10 #include <X11/Xlib.h> |
| 9 #include <X11/extensions/XInput2.h> | |
| 10 #include <X11/extensions/Xfixes.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/events/devices/device_data_manager.h" | 25 #include "ui/events/devices/device_data_manager.h" |
| 25 #include "ui/events/devices/x11/device_list_cache_x11.h" | 26 #include "ui/events/devices/x11/device_list_cache_x11.h" |
| 26 #include "ui/events/devices/x11/touch_factory_x11.h" | 27 #include "ui/events/devices/x11/touch_factory_x11.h" |
| 27 #include "ui/events/event.h" | 28 #include "ui/events/event.h" |
| 28 #include "ui/events/event_utils.h" | 29 #include "ui/events/event_utils.h" |
| 29 #include "ui/events/null_event_targeter.h" | 30 #include "ui/events/null_event_targeter.h" |
| 30 #include "ui/events/platform/platform_event_source.h" | 31 #include "ui/events/platform/platform_event_source.h" |
| 31 #include "ui/gfx/geometry/rect.h" | 32 #include "ui/gfx/geometry/rect.h" |
| 32 #include "ui/gfx/screen.h" | |
| 33 | 33 |
| 34 namespace ash { | 34 namespace ash { |
| 35 | 35 |
| 36 AshWindowTreeHostX11::AshWindowTreeHostX11(const gfx::Rect& initial_bounds) | 36 AshWindowTreeHostX11::AshWindowTreeHostX11(const gfx::Rect& initial_bounds) |
| 37 : WindowTreeHostX11(initial_bounds), transformer_helper_(this) { | 37 : WindowTreeHostX11(initial_bounds), transformer_helper_(this) { |
| 38 transformer_helper_.Init(); | 38 transformer_helper_.Init(); |
| 39 aura::Env::GetInstance()->AddObserver(this); | 39 aura::Env::GetInstance()->AddObserver(this); |
| 40 } | 40 } |
| 41 | 41 |
| 42 AshWindowTreeHostX11::~AshWindowTreeHostX11() { | 42 AshWindowTreeHostX11::~AshWindowTreeHostX11() { |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 206 case ui::ET_TOUCH_RELEASED: { | 206 case ui::ET_TOUCH_RELEASED: { |
| 207 #if defined(OS_CHROMEOS) | 207 #if defined(OS_CHROMEOS) |
| 208 XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(xev->xcookie.data); | 208 XIDeviceEvent* xiev = static_cast<XIDeviceEvent*>(xev->xcookie.data); |
| 209 int64_t touch_display_id = | 209 int64_t touch_display_id = |
| 210 ui::DeviceDataManager::GetInstance()->GetTargetDisplayForTouchDevice( | 210 ui::DeviceDataManager::GetInstance()->GetTargetDisplayForTouchDevice( |
| 211 xiev->deviceid); | 211 xiev->deviceid); |
| 212 // 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 |
| 213 // 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 |
| 214 // that in multi-monitor case, the event position is in framebuffer | 214 // that in multi-monitor case, the event position is in framebuffer |
| 215 // space so the bounds check will not work so well. | 215 // space so the bounds check will not work so well. |
| 216 if (touch_display_id == gfx::Display::kInvalidDisplayID) { | 216 if (touch_display_id == display::Display::kInvalidDisplayID) { |
| 217 if (base::SysInfo::IsRunningOnChromeOS() && | 217 if (base::SysInfo::IsRunningOnChromeOS() && |
| 218 !bounds().Contains(ui::EventLocationFromNative(xev))) | 218 !bounds().Contains(ui::EventLocationFromNative(xev))) |
| 219 return false; | 219 return false; |
| 220 } else { | 220 } else { |
| 221 gfx::Screen* screen = gfx::Screen::GetScreen(); | 221 display::Screen* screen = display::Screen::GetScreen(); |
| 222 gfx::Display display = screen->GetDisplayNearestWindow(window()); | 222 display::Display display = screen->GetDisplayNearestWindow(window()); |
| 223 return touch_display_id == display.id(); | 223 return touch_display_id == display.id(); |
| 224 } | 224 } |
| 225 #endif // defined(OS_CHROMEOS) | 225 #endif // defined(OS_CHROMEOS) |
| 226 return true; | 226 return true; |
| 227 } | 227 } |
| 228 default: | 228 default: |
| 229 return true; | 229 return true; |
| 230 } | 230 } |
| 231 } | 231 } |
| 232 void AshWindowTreeHostX11::TranslateAndDispatchLocatedEvent( | 232 void AshWindowTreeHostX11::TranslateAndDispatchLocatedEvent( |
| (...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 284 8, | 284 8, |
| 285 PropModeReplace, | 285 PropModeReplace, |
| 286 &value, | 286 &value, |
| 287 1); | 287 1); |
| 288 } | 288 } |
| 289 } | 289 } |
| 290 } | 290 } |
| 291 #endif // defined(OS_CHROMEOS) | 291 #endif // defined(OS_CHROMEOS) |
| 292 | 292 |
| 293 } // namespace ash | 293 } // namespace ash |
| OLD | NEW |