Chromium Code Reviews| 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 #include "base/bind.h" | 8 #include "base/bind.h" |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "ui/aura/client/screen_position_client.h" | 10 #include "ui/aura/client/screen_position_client.h" |
| 11 #include "ui/aura/env.h" | 11 #include "ui/aura/env.h" |
| 12 #include "ui/aura/test/aura_test_utils.h" | |
| 12 #include "ui/aura/test/ui_controls_factory_aura.h" | 13 #include "ui/aura/test/ui_controls_factory_aura.h" |
| 13 #include "ui/aura/window.h" | 14 #include "ui/aura/window.h" |
| 14 #include "ui/aura/window_tree_host.h" | 15 #include "ui/aura/window_tree_host.h" |
| 15 #include "ui/base/test/ui_controls_aura.h" | 16 #include "ui/base/test/ui_controls_aura.h" |
| 16 #include "ui/base/x/x11_util.h" | 17 #include "ui/base/x/x11_util.h" |
| 17 #include "ui/compositor/dip_util.h" | 18 #include "ui/compositor/dip_util.h" |
| 18 #include "ui/events/keycodes/keyboard_code_conversion_x.h" | 19 #include "ui/events/keycodes/keyboard_code_conversion_x.h" |
| 19 #include "ui/events/test/platform_event_waiter.h" | 20 #include "ui/events/test/platform_event_waiter.h" |
| 20 | 21 |
| 21 namespace aura { | 22 namespace aura { |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 103 long screen_y, | 104 long screen_y, |
| 104 const base::Closure& closure) OVERRIDE { | 105 const base::Closure& closure) OVERRIDE { |
| 105 gfx::Point root_location(screen_x, screen_y); | 106 gfx::Point root_location(screen_x, screen_y); |
| 106 aura::client::ScreenPositionClient* screen_position_client = | 107 aura::client::ScreenPositionClient* screen_position_client = |
| 107 aura::client::GetScreenPositionClient(host_->window()); | 108 aura::client::GetScreenPositionClient(host_->window()); |
| 108 if (screen_position_client) { | 109 if (screen_position_client) { |
| 109 screen_position_client->ConvertPointFromScreen(host_->window(), | 110 screen_position_client->ConvertPointFromScreen(host_->window(), |
| 110 &root_location); | 111 &root_location); |
| 111 } | 112 } |
| 112 gfx::Point root_current_location; | 113 gfx::Point root_current_location; |
| 113 host_->QueryMouseLocation(&root_current_location); | 114 WindowTreeHostTestApi host_test_api(host_); |
|
sky
2014/04/25 22:46:19
How about a static function that does all this? It
sadrul
2014/04/26 01:34:58
Done. (moved WindowTreeHostTestApi into the cc fil
| |
| 115 root_current_location = | |
| 116 host_test_api.last_cursor_request_position_in_host(); | |
| 114 host_->ConvertPointFromHost(&root_current_location); | 117 host_->ConvertPointFromHost(&root_current_location); |
| 115 | 118 |
| 116 if (root_location != root_current_location && button_down_mask == 0) { | 119 if (root_location != root_current_location && button_down_mask == 0) { |
| 117 // Move the cursor because EnterNotify/LeaveNotify are generated with the | 120 // Move the cursor because EnterNotify/LeaveNotify are generated with the |
| 118 // current mouse position as a result of XGrabPointer() | 121 // current mouse position as a result of XGrabPointer() |
| 119 host_->window()->MoveCursorTo(root_location); | 122 host_->window()->MoveCursorTo(root_location); |
| 120 } else { | 123 } else { |
| 121 XEvent xevent = {0}; | 124 XEvent xevent = {0}; |
| 122 XMotionEvent* xmotion = &xevent.xmotion; | 125 XMotionEvent* xmotion = &xevent.xmotion; |
| 123 xmotion->type = MotionNotify; | 126 xmotion->type = MotionNotify; |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 222 }; | 225 }; |
| 223 | 226 |
| 224 } // namespace | 227 } // namespace |
| 225 | 228 |
| 226 UIControlsAura* CreateUIControlsAura(WindowTreeHost* host) { | 229 UIControlsAura* CreateUIControlsAura(WindowTreeHost* host) { |
| 227 return new UIControlsX11(host); | 230 return new UIControlsX11(host); |
| 228 } | 231 } |
| 229 | 232 |
| 230 } // namespace test | 233 } // namespace test |
| 231 } // namespace aura | 234 } // namespace aura |
| OLD | NEW |