OLD | NEW |
---|---|
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "chrome/browser/automation/ui_controls.h" | 5 #include "chrome/browser/automation/ui_controls.h" |
6 | 6 |
7 #include <X11/keysym.h> | 7 #include <X11/keysym.h> |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 | 9 |
10 #include "base/callback.h" | 10 #include "base/callback.h" |
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
126 const base::Closure& closure) { | 126 const base::Closure& closure) { |
127 DCHECK(!command); // No command key on Aura | 127 DCHECK(!command); // No command key on Aura |
128 XEvent xevent = {0}; | 128 XEvent xevent = {0}; |
129 xevent.xkey.type = KeyPress; | 129 xevent.xkey.type = KeyPress; |
130 if (control) | 130 if (control) |
131 SetMaskAndKeycodeThenSend(&xevent, ControlMask, XK_Control_L); | 131 SetMaskAndKeycodeThenSend(&xevent, ControlMask, XK_Control_L); |
132 if (shift) | 132 if (shift) |
133 SetMaskAndKeycodeThenSend(&xevent, ShiftMask, XK_Shift_L); | 133 SetMaskAndKeycodeThenSend(&xevent, ShiftMask, XK_Shift_L); |
134 if (alt) | 134 if (alt) |
135 SetMaskAndKeycodeThenSend(&xevent, Mod1Mask, XK_Alt_L); | 135 SetMaskAndKeycodeThenSend(&xevent, Mod1Mask, XK_Alt_L); |
136 xevent.xkey.keycode = ui::XKeysymForWindowsKeyCode(key, shift); | 136 xevent.xkey.keycode = |
137 XKeysymToKeycode(base::MessagePumpX::GetDefaultXDisplay(), | |
Daniel Erat
2011/12/05 19:40:38
we should also be calling XRefreshKeyboardMapping(
| |
138 ui::XKeysymForWindowsKeyCode(key, shift)); | |
137 aura::Desktop::GetInstance()->PostNativeEvent(&xevent); | 139 aura::Desktop::GetInstance()->PostNativeEvent(&xevent); |
138 | 140 |
139 // Send key release events. | 141 // Send key release events. |
140 xevent.xkey.type = KeyRelease; | 142 xevent.xkey.type = KeyRelease; |
141 aura::Desktop::GetInstance()->PostNativeEvent(&xevent); | 143 aura::Desktop::GetInstance()->PostNativeEvent(&xevent); |
142 if (alt) | 144 if (alt) |
143 SetKeycodeAndSendThenUnmask(&xevent, Mod1Mask, XK_Alt_L); | 145 SetKeycodeAndSendThenUnmask(&xevent, Mod1Mask, XK_Alt_L); |
144 if (shift) | 146 if (shift) |
145 SetKeycodeAndSendThenUnmask(&xevent, ShiftMask, XK_Shift_L); | 147 SetKeycodeAndSendThenUnmask(&xevent, ShiftMask, XK_Shift_L); |
146 if (control) | 148 if (control) |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
218 int state, const base::Closure& closure) { | 220 int state, const base::Closure& closure) { |
219 DCHECK(view); | 221 DCHECK(view); |
220 DCHECK(view->GetWidget()); | 222 DCHECK(view->GetWidget()); |
221 gfx::Point view_center(view->width() / 2, view->height() / 2); | 223 gfx::Point view_center(view->width() / 2, view->height() / 2); |
222 views::View::ConvertPointToScreen(view, &view_center); | 224 views::View::ConvertPointToScreen(view, &view_center); |
223 SendMouseMove(view_center.x(), view_center.y()); | 225 SendMouseMove(view_center.x(), view_center.y()); |
224 SendMouseEventsNotifyWhenDone(button, state, closure); | 226 SendMouseEventsNotifyWhenDone(button, state, closure); |
225 } | 227 } |
226 | 228 |
227 } // namespace ui_controls | 229 } // namespace ui_controls |
OLD | NEW |