Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(44)

Side by Side Diff: ui/aura/test/ui_controls_factory_aurax11.cc

Issue 149743006: Fix crash of OmniboxViewViewsTest.SelectAllOnClick on Linux Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
132 DCHECK(!xevent.xkey.state); 132 DCHECK(!xevent.xkey.state);
133 RunClosureAfterAllPendingUIEvents(closure); 133 RunClosureAfterAllPendingUIEvents(closure);
134 return true; 134 return true;
135 } 135 }
136 136
137 // Simulate a mouse move. (x,y) are absolute screen coordinates. 137 // Simulate a mouse move. (x,y) are absolute screen coordinates.
138 virtual bool SendMouseMove(long x, long y) OVERRIDE { 138 virtual bool SendMouseMove(long x, long y) OVERRIDE {
139 return SendMouseMoveNotifyWhenDone(x, y, base::Closure()); 139 return SendMouseMoveNotifyWhenDone(x, y, base::Closure());
140 } 140 }
141 virtual bool SendMouseMoveNotifyWhenDone( 141 virtual bool SendMouseMoveNotifyWhenDone(
142 long x, 142 long root_x,
sadrul 2014/02/14 19:18:10 The desktop version calls this screen_x, screen_y
pkotwicz 2014/02/14 19:57:18 Root window coordinates are passed in. The documen
143 long y, 143 long root_y,
144 const base::Closure& closure) OVERRIDE { 144 const base::Closure& closure) OVERRIDE {
145 XEvent xevent = {0}; 145 gfx::Point root_location(static_cast<int>(root_x),
146 XMotionEvent* xmotion = &xevent.xmotion; 146 static_cast<int>(root_y));
147 xmotion->type = MotionNotify; 147
148 gfx::Point point = ui::ConvertPointToPixel( 148 gfx::Point root_current_location;
149 root_window_->window()->layer(), 149 root_window_->host()->QueryMouseLocation(&root_current_location);
150 gfx::Point(static_cast<int>(x), static_cast<int>(y))); 150 root_window_->host()->ConvertPointFromHost(&root_current_location);
151 xmotion->x = point.x(); 151
152 xmotion->y = point.y(); 152 if (root_location != root_current_location && button_down_mask == 0) {
153 xmotion->state = button_down_mask; 153 // Move the cursor because EnterNotify/LeaveNotify are generated with the
154 xmotion->same_screen = True; 154 // current mouse position as a result of XGrabPointer()
155 // RootWindow will take care of other necessary fields. 155 root_window_->MoveCursorTo(root_location);
156 root_window_->host()->PostNativeEvent(&xevent); 156 } else {
157 XEvent xevent = {0};
158 XMotionEvent* xmotion = &xevent.xmotion;
159 xmotion->type = MotionNotify;
160 xmotion->x = root_location.x();
161 xmotion->y = root_location.y();
162 xmotion->state = button_down_mask;
163 xmotion->same_screen = True;
164 // RootWindow will take care of other necessary fields.
165 root_window_->host()->PostNativeEvent(&xevent);
166 }
157 RunClosureAfterAllPendingUIEvents(closure); 167 RunClosureAfterAllPendingUIEvents(closure);
158 return true; 168 return true;
159 } 169 }
160 virtual bool SendMouseEvents(MouseButton type, int state) OVERRIDE { 170 virtual bool SendMouseEvents(MouseButton type, int state) OVERRIDE {
161 return SendMouseEventsNotifyWhenDone(type, state, base::Closure()); 171 return SendMouseEventsNotifyWhenDone(type, state, base::Closure());
162 } 172 }
163 virtual bool SendMouseEventsNotifyWhenDone( 173 virtual bool SendMouseEventsNotifyWhenDone(
164 MouseButton type, 174 MouseButton type,
165 int state, 175 int state,
166 const base::Closure& closure) OVERRIDE { 176 const base::Closure& closure) OVERRIDE {
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
248 }; 258 };
249 259
250 } // namespace 260 } // namespace
251 261
252 UIControlsAura* CreateUIControlsAura(aura::RootWindow* root_window) { 262 UIControlsAura* CreateUIControlsAura(aura::RootWindow* root_window) {
253 return new UIControlsX11(root_window); 263 return new UIControlsX11(root_window);
254 } 264 }
255 265
256 } // namespace test 266 } // namespace test
257 } // namespace aura 267 } // namespace aura
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698