| 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/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h" | 5 #include "ash/wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h" |
| 6 | 6 |
| 7 #include <X11/extensions/XInput2.h> | 7 #include <X11/extensions/XInput2.h> |
| 8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
| 9 | 9 |
| 10 #include <memory> | 10 #include <memory> |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 54 if (!display.is_valid()) | 54 if (!display.is_valid()) |
| 55 return; | 55 return; |
| 56 aura::Window* root_window = Shell::GetInstance() | 56 aura::Window* root_window = Shell::GetInstance() |
| 57 ->window_tree_host_manager() | 57 ->window_tree_host_manager() |
| 58 ->GetRootWindowForDisplayId(display.id()); | 58 ->GetRootWindowForDisplayId(display.id()); |
| 59 gfx::Point host_location(screen_location); | 59 gfx::Point host_location(screen_location); |
| 60 aura::client::ScreenPositionClient* client = | 60 aura::client::ScreenPositionClient* client = |
| 61 aura::client::GetScreenPositionClient(root_window); | 61 aura::client::GetScreenPositionClient(root_window); |
| 62 if (client) | 62 if (client) |
| 63 client->ConvertPointFromScreen(root_window, &host_location); | 63 client->ConvertPointFromScreen(root_window, &host_location); |
| 64 root_window->GetHost()->MoveCursorTo(host_location); | 64 root_window->GetHost()->MoveCursorToLocationInDIP(host_location); |
| 65 } | 65 } |
| 66 | 66 |
| 67 } // namespace | 67 } // namespace |
| 68 | 68 |
| 69 ScopedDisableInternalMouseAndKeyboardX11:: | 69 ScopedDisableInternalMouseAndKeyboardX11:: |
| 70 ScopedDisableInternalMouseAndKeyboardX11() | 70 ScopedDisableInternalMouseAndKeyboardX11() |
| 71 : touchpad_device_id_(kDeviceIdNone), | 71 : touchpad_device_id_(kDeviceIdNone), |
| 72 keyboard_device_id_(kDeviceIdNone), | 72 keyboard_device_id_(kDeviceIdNone), |
| 73 core_keyboard_device_id_(kDeviceIdNone), | 73 core_keyboard_device_id_(kDeviceIdNone), |
| 74 last_mouse_location_(GetMouseLocationInScreen()) { | 74 last_mouse_location_(GetMouseLocationInScreen()) { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 // blocked. Move the mouse cursor back to its last known location resulting | 156 // blocked. Move the mouse cursor back to its last known location resulting |
| 157 // from an external mouse to prevent the internal touchpad from moving it. | 157 // from an external mouse to prevent the internal touchpad from moving it. |
| 158 SetMouseLocationInScreen(last_mouse_location_); | 158 SetMouseLocationInScreen(last_mouse_location_); |
| 159 } else { | 159 } else { |
| 160 // Track the last location seen from an external mouse event. | 160 // Track the last location seen from an external mouse event. |
| 161 last_mouse_location_ = GetMouseLocationInScreen(); | 161 last_mouse_location_ = GetMouseLocationInScreen(); |
| 162 } | 162 } |
| 163 } | 163 } |
| 164 | 164 |
| 165 } // namespace ash | 165 } // namespace ash |
| OLD | NEW |