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" |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 70 const base::Closure& closure) OVERRIDE { | 70 const base::Closure& closure) OVERRIDE { |
| 71 DCHECK(!command); // No command key on Aura | 71 DCHECK(!command); // No command key on Aura |
| 72 XEvent xevent = {0}; | 72 XEvent xevent = {0}; |
| 73 xevent.xkey.type = KeyPress; | 73 xevent.xkey.type = KeyPress; |
| 74 if (control) | 74 if (control) |
| 75 SetKeycodeAndSendThenMask(&xevent, XK_Control_L, ControlMask); | 75 SetKeycodeAndSendThenMask(&xevent, XK_Control_L, ControlMask); |
| 76 if (shift) | 76 if (shift) |
| 77 SetKeycodeAndSendThenMask(&xevent, XK_Shift_L, ShiftMask); | 77 SetKeycodeAndSendThenMask(&xevent, XK_Shift_L, ShiftMask); |
| 78 if (alt) | 78 if (alt) |
| 79 SetKeycodeAndSendThenMask(&xevent, XK_Alt_L, Mod1Mask); | 79 SetKeycodeAndSendThenMask(&xevent, XK_Alt_L, Mod1Mask); |
| 80 if (command) | |
| 81 SetKeycodeAndSendThenMask(&xevent, XK_Super_L, Mod4Mask); | |
| 80 xevent.xkey.keycode = | 82 xevent.xkey.keycode = |
| 81 XKeysymToKeycode(gfx::GetXDisplay(), | 83 XKeysymToKeycode(gfx::GetXDisplay(), |
| 82 ui::XKeysymForWindowsKeyCode(key, shift)); | 84 ui::XKeysymForWindowsKeyCode(key, shift)); |
| 83 host_->PostNativeEvent(&xevent); | 85 host_->PostNativeEvent(&xevent); |
| 84 | 86 |
| 85 // Send key release events. | 87 // Send key release events. |
| 86 xevent.xkey.type = KeyRelease; | 88 xevent.xkey.type = KeyRelease; |
| 87 host_->PostNativeEvent(&xevent); | 89 host_->PostNativeEvent(&xevent); |
| 88 if (alt) | 90 if (alt) |
| 89 UnmaskAndSetKeycodeThenSend(&xevent, Mod1Mask, XK_Alt_L); | 91 UnmaskAndSetKeycodeThenSend(&xevent, Mod1Mask, XK_Alt_L); |
| 90 if (shift) | 92 if (shift) |
| 91 UnmaskAndSetKeycodeThenSend(&xevent, ShiftMask, XK_Shift_L); | 93 UnmaskAndSetKeycodeThenSend(&xevent, ShiftMask, XK_Shift_L); |
| 92 if (control) | 94 if (control) |
| 93 UnmaskAndSetKeycodeThenSend(&xevent, ControlMask, XK_Control_L); | 95 UnmaskAndSetKeycodeThenSend(&xevent, ControlMask, XK_Control_L); |
| 96 if (command) | |
| 97 UnmaskAndSetKeycodeThenSend(&xevent, Mod4Mask, XK_Super_L); | |
|
David Tseng
2014/08/19 17:48:38
Was this removed recently? If not, how did ChromeV
dmazzoni
2014/08/19 20:16:53
This is just a test helper. Tests that used this l
| |
| 94 DCHECK(!xevent.xkey.state); | 98 DCHECK(!xevent.xkey.state); |
| 95 RunClosureAfterAllPendingUIEvents(closure); | 99 RunClosureAfterAllPendingUIEvents(closure); |
| 96 return true; | 100 return true; |
| 97 } | 101 } |
| 98 | 102 |
| 99 virtual bool SendMouseMove(long screen_x, long screen_y) OVERRIDE { | 103 virtual bool SendMouseMove(long screen_x, long screen_y) OVERRIDE { |
| 100 return SendMouseMoveNotifyWhenDone(screen_x, screen_y, base::Closure()); | 104 return SendMouseMoveNotifyWhenDone(screen_x, screen_y, base::Closure()); |
| 101 } | 105 } |
| 102 virtual bool SendMouseMoveNotifyWhenDone( | 106 virtual bool SendMouseMoveNotifyWhenDone( |
| 103 long screen_x, | 107 long screen_x, |
| (...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 223 }; | 227 }; |
| 224 | 228 |
| 225 } // namespace | 229 } // namespace |
| 226 | 230 |
| 227 UIControlsAura* CreateUIControlsAura(WindowTreeHost* host) { | 231 UIControlsAura* CreateUIControlsAura(WindowTreeHost* host) { |
| 228 return new UIControlsX11(host); | 232 return new UIControlsX11(host); |
| 229 } | 233 } |
| 230 | 234 |
| 231 } // namespace test | 235 } // namespace test |
| 232 } // namespace aura | 236 } // namespace aura |
| OLD | NEW |