OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 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 <X11/keysym.h> | 5 #include <X11/keysym.h> |
6 #include <X11/Xlib.h> | 6 #include <X11/Xlib.h> |
7 | 7 |
8 // X macro fail. | 8 // X macro fail. |
9 #if defined(RootWindow) | 9 #if defined(RootWindow) |
10 #undef RootWindow | 10 #undef RootWindow |
11 #endif | 11 #endif |
12 | 12 |
13 #include "base/bind.h" | 13 #include "base/bind.h" |
14 #include "base/logging.h" | 14 #include "base/logging.h" |
15 #include "ui/aura/client/screen_position_client.h" | 15 #include "ui/aura/client/screen_position_client.h" |
16 #include "ui/aura/env.h" | 16 #include "ui/aura/env.h" |
| 17 #include "ui/aura/test/aura_test_utils.h" |
17 #include "ui/aura/test/ui_controls_factory_aura.h" | 18 #include "ui/aura/test/ui_controls_factory_aura.h" |
18 #include "ui/aura/window_event_dispatcher.h" | 19 #include "ui/aura/window_event_dispatcher.h" |
19 #include "ui/base/test/ui_controls_aura.h" | 20 #include "ui/base/test/ui_controls_aura.h" |
20 #include "ui/base/x/x11_util.h" | 21 #include "ui/base/x/x11_util.h" |
21 #include "ui/compositor/dip_util.h" | 22 #include "ui/compositor/dip_util.h" |
22 #include "ui/events/keycodes/keyboard_code_conversion_x.h" | 23 #include "ui/events/keycodes/keyboard_code_conversion_x.h" |
23 #include "ui/events/test/platform_event_waiter.h" | 24 #include "ui/events/test/platform_event_waiter.h" |
24 #include "ui/gfx/x/x11_connection.h" | 25 #include "ui/gfx/x/x11_connection.h" |
25 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" | 26 #include "ui/views/widget/desktop_aura/desktop_window_tree_host_x11.h" |
26 | 27 |
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 aura::Window* root_window = RootWindowForPoint(screen_location); | 136 aura::Window* root_window = RootWindowForPoint(screen_location); |
136 | 137 |
137 aura::client::ScreenPositionClient* screen_position_client = | 138 aura::client::ScreenPositionClient* screen_position_client = |
138 aura::client::GetScreenPositionClient(root_window); | 139 aura::client::GetScreenPositionClient(root_window); |
139 if (screen_position_client) { | 140 if (screen_position_client) { |
140 screen_position_client->ConvertPointFromScreen(root_window, | 141 screen_position_client->ConvertPointFromScreen(root_window, |
141 &root_location); | 142 &root_location); |
142 } | 143 } |
143 | 144 |
144 aura::WindowTreeHost* host = root_window->GetHost(); | 145 aura::WindowTreeHost* host = root_window->GetHost(); |
145 gfx::Point root_current_location; | 146 gfx::Point root_current_location = |
146 host->QueryMouseLocation(&root_current_location); | 147 aura::test::QueryLatestMousePositionRequestInHost(host); |
147 host->ConvertPointFromHost(&root_current_location); | 148 host->ConvertPointFromHost(&root_current_location); |
148 | 149 |
149 if (root_location != root_current_location && button_down_mask == 0) { | 150 if (root_location != root_current_location && button_down_mask == 0) { |
150 // Move the cursor because EnterNotify/LeaveNotify are generated with the | 151 // Move the cursor because EnterNotify/LeaveNotify are generated with the |
151 // current mouse position as a result of XGrabPointer() | 152 // current mouse position as a result of XGrabPointer() |
152 root_window->MoveCursorTo(root_location); | 153 root_window->MoveCursorTo(root_location); |
153 } else { | 154 } else { |
154 XEvent xevent = {0}; | 155 XEvent xevent = {0}; |
155 XMotionEvent* xmotion = &xevent.xmotion; | 156 XMotionEvent* xmotion = &xevent.xmotion; |
156 xmotion->type = MotionNotify; | 157 xmotion->type = MotionNotify; |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
282 | 283 |
283 UIControlsAura* CreateUIControlsDesktopAura() { | 284 UIControlsAura* CreateUIControlsDesktopAura() { |
284 // The constructor of UIControlsDesktopX11 needs X11 connection to be | 285 // The constructor of UIControlsDesktopX11 needs X11 connection to be |
285 // initialized. | 286 // initialized. |
286 gfx::InitializeThreadedX11(); | 287 gfx::InitializeThreadedX11(); |
287 return new UIControlsDesktopX11(); | 288 return new UIControlsDesktopX11(); |
288 } | 289 } |
289 | 290 |
290 } // namespace test | 291 } // namespace test |
291 } // namespace views | 292 } // namespace views |
OLD | NEW |