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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 const base::Closure& closure) { | 110 const base::Closure& closure) { |
111 DCHECK(!command); // No command key on Aura | 111 DCHECK(!command); // No command key on Aura |
112 XEvent xevent = {0}; | 112 XEvent xevent = {0}; |
113 xevent.xkey.type = KeyPress; | 113 xevent.xkey.type = KeyPress; |
114 if (control) | 114 if (control) |
115 SetMaskAndKeycodeThenSend(&xevent, ControlMask, XK_Control_L); | 115 SetMaskAndKeycodeThenSend(&xevent, ControlMask, XK_Control_L); |
116 if (shift) | 116 if (shift) |
117 SetMaskAndKeycodeThenSend(&xevent, ShiftMask, XK_Shift_L); | 117 SetMaskAndKeycodeThenSend(&xevent, ShiftMask, XK_Shift_L); |
118 if (alt) | 118 if (alt) |
119 SetMaskAndKeycodeThenSend(&xevent, Mod1Mask, XK_Alt_L); | 119 SetMaskAndKeycodeThenSend(&xevent, Mod1Mask, XK_Alt_L); |
120 xevent.xkey.keycode = ui::XKeysymForWindowsKeyCode(key, shift); | 120 xevent.xkey.keycode = |
| 121 XKeysymToKeycode(base::MessagePumpX::GetDefaultXDisplay(), |
| 122 ui::XKeysymForWindowsKeyCode(key, shift)); |
121 aura::Desktop::GetInstance()->PostNativeEvent(&xevent); | 123 aura::Desktop::GetInstance()->PostNativeEvent(&xevent); |
122 | 124 |
123 // Send key release events. | 125 // Send key release events. |
124 xevent.xkey.type = KeyRelease; | 126 xevent.xkey.type = KeyRelease; |
125 aura::Desktop::GetInstance()->PostNativeEvent(&xevent); | 127 aura::Desktop::GetInstance()->PostNativeEvent(&xevent); |
126 if (alt) | 128 if (alt) |
127 SetKeycodeAndSendThenUnmask(&xevent, Mod1Mask, XK_Alt_L); | 129 SetKeycodeAndSendThenUnmask(&xevent, Mod1Mask, XK_Alt_L); |
128 if (shift) | 130 if (shift) |
129 SetKeycodeAndSendThenUnmask(&xevent, ShiftMask, XK_Shift_L); | 131 SetKeycodeAndSendThenUnmask(&xevent, ShiftMask, XK_Shift_L); |
130 if (control) | 132 if (control) |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
218 marker_event->xclient.display = NULL; | 220 marker_event->xclient.display = NULL; |
219 marker_event->xclient.window = None; | 221 marker_event->xclient.window = None; |
220 marker_event->xclient.format = 8; | 222 marker_event->xclient.format = 8; |
221 } | 223 } |
222 marker_event->xclient.message_type = MarkerEventAtom(); | 224 marker_event->xclient.message_type = MarkerEventAtom(); |
223 aura::Desktop::GetInstance()->PostNativeEvent(marker_event); | 225 aura::Desktop::GetInstance()->PostNativeEvent(marker_event); |
224 new EventWaiter(closure, &Matcher); | 226 new EventWaiter(closure, &Matcher); |
225 } | 227 } |
226 | 228 |
227 } // namespace ui_controls | 229 } // namespace ui_controls |
OLD | NEW |