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

Side by Side Diff: ui/aura/ui_controls_x11.cc

Issue 11033038: Fix the issue of cursor's device scale factor when using monitors with differnt device scale factor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix a comment Created 8 years, 2 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
« no previous file with comments | « ui/aura/shared/compound_event_filter.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/logging.h" 13 #include "base/logging.h"
14 #include "base/message_pump_aurax11.h" 14 #include "base/message_pump_aurax11.h"
15 #include "ui/aura/root_window.h" 15 #include "ui/aura/root_window.h"
16 #include "ui/aura/ui_controls_aura.h" 16 #include "ui/aura/ui_controls_aura.h"
17 #include "ui/base/keycodes/keyboard_code_conversion_x.h" 17 #include "ui/base/keycodes/keyboard_code_conversion_x.h"
18 #include "ui/compositor/dip_util.h"
18 #include "ui/ui_controls/ui_controls_aura.h" 19 #include "ui/ui_controls/ui_controls_aura.h"
19 20
20 namespace aura { 21 namespace aura {
21 namespace { 22 namespace {
22 23
23 // Mask of the buttons currently down. 24 // Mask of the buttons currently down.
24 unsigned button_down_mask = 0; 25 unsigned button_down_mask = 0;
25 26
26 // Event waiter executes the specified closure|when a matching event 27 // Event waiter executes the specified closure|when a matching event
27 // is found. 28 // is found.
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
129 // Simulate a mouse move. (x,y) are absolute screen coordinates. 130 // Simulate a mouse move. (x,y) are absolute screen coordinates.
130 virtual bool SendMouseMove(long x, long y) { 131 virtual bool SendMouseMove(long x, long y) {
131 return SendMouseMoveNotifyWhenDone(x, y, base::Closure()); 132 return SendMouseMoveNotifyWhenDone(x, y, base::Closure());
132 } 133 }
133 virtual bool SendMouseMoveNotifyWhenDone(long x, 134 virtual bool SendMouseMoveNotifyWhenDone(long x,
134 long y, 135 long y,
135 const base::Closure& closure) { 136 const base::Closure& closure) {
136 XEvent xevent = {0}; 137 XEvent xevent = {0};
137 XMotionEvent* xmotion = &xevent.xmotion; 138 XMotionEvent* xmotion = &xevent.xmotion;
138 xmotion->type = MotionNotify; 139 xmotion->type = MotionNotify;
139 g_current_x = xmotion->x = x; 140 gfx::Point point = ui::ConvertPointToPixel(
140 g_current_y = xmotion->y = y; 141 root_window_->layer(),
142 gfx::Point(static_cast<int>(x), static_cast<int>(y)));
143 g_current_x = xmotion->x = point.x();
144 g_current_y = xmotion->y = point.y();
141 xmotion->state = button_down_mask; 145 xmotion->state = button_down_mask;
142 xmotion->same_screen = True; 146 xmotion->same_screen = True;
143 // RootWindow will take care of other necessary fields. 147 // RootWindow will take care of other necessary fields.
144 root_window_->PostNativeEvent(&xevent); 148 root_window_->PostNativeEvent(&xevent);
145 RunClosureAfterAllPendingUIEvents(closure); 149 RunClosureAfterAllPendingUIEvents(closure);
146 return true; 150 return true;
147 } 151 }
148 virtual bool SendMouseEvents(ui_controls::MouseButton type, int state) { 152 virtual bool SendMouseEvents(ui_controls::MouseButton type, int state) {
149 return SendMouseEventsNotifyWhenDone(type, state, base::Closure()); 153 return SendMouseEventsNotifyWhenDone(type, state, base::Closure());
150 } 154 }
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
230 DISALLOW_COPY_AND_ASSIGN(UIControlsX11); 234 DISALLOW_COPY_AND_ASSIGN(UIControlsX11);
231 }; 235 };
232 236
233 } // namespace 237 } // namespace
234 238
235 ui_controls::UIControlsAura* CreateUIControlsAura(RootWindow* root_window) { 239 ui_controls::UIControlsAura* CreateUIControlsAura(RootWindow* root_window) {
236 return new UIControlsX11(root_window); 240 return new UIControlsX11(root_window);
237 } 241 }
238 242
239 } // namespace aura 243 } // namespace aura
OLDNEW
« no previous file with comments | « ui/aura/shared/compound_event_filter.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698