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 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
69 const base::Closure& closure) OVERRIDE { | 69 const base::Closure& closure) OVERRIDE { |
70 XEvent xevent = {0}; | 70 XEvent xevent = {0}; |
71 xevent.xkey.type = KeyPress; | 71 xevent.xkey.type = KeyPress; |
72 if (control) | 72 if (control) |
73 SetKeycodeAndSendThenMask(&xevent, XK_Control_L, ControlMask); | 73 SetKeycodeAndSendThenMask(&xevent, XK_Control_L, ControlMask); |
74 if (shift) | 74 if (shift) |
75 SetKeycodeAndSendThenMask(&xevent, XK_Shift_L, ShiftMask); | 75 SetKeycodeAndSendThenMask(&xevent, XK_Shift_L, ShiftMask); |
76 if (alt) | 76 if (alt) |
77 SetKeycodeAndSendThenMask(&xevent, XK_Alt_L, Mod1Mask); | 77 SetKeycodeAndSendThenMask(&xevent, XK_Alt_L, Mod1Mask); |
78 if (command) | 78 if (command) |
79 SetKeycodeAndSendThenMask(&xevent, XK_Meta_L, Mod4Mask); | 79 SetKeycodeAndSendThenMask(&xevent, XK_Super_L, Mod4Mask); |
80 xevent.xkey.keycode = | 80 xevent.xkey.keycode = |
81 XKeysymToKeycode(gfx::GetXDisplay(), | 81 XKeysymToKeycode(gfx::GetXDisplay(), |
82 ui::XKeysymForWindowsKeyCode(key, shift)); | 82 ui::XKeysymForWindowsKeyCode(key, shift)); |
83 host_->PostNativeEvent(&xevent); | 83 host_->PostNativeEvent(&xevent); |
84 | 84 |
85 // Send key release events. | 85 // Send key release events. |
86 xevent.xkey.type = KeyRelease; | 86 xevent.xkey.type = KeyRelease; |
87 host_->PostNativeEvent(&xevent); | 87 host_->PostNativeEvent(&xevent); |
88 if (alt) | 88 if (alt) |
89 UnmaskAndSetKeycodeThenSend(&xevent, Mod1Mask, XK_Alt_L); | 89 UnmaskAndSetKeycodeThenSend(&xevent, Mod1Mask, XK_Alt_L); |
90 if (shift) | 90 if (shift) |
91 UnmaskAndSetKeycodeThenSend(&xevent, ShiftMask, XK_Shift_L); | 91 UnmaskAndSetKeycodeThenSend(&xevent, ShiftMask, XK_Shift_L); |
92 if (control) | 92 if (control) |
93 UnmaskAndSetKeycodeThenSend(&xevent, ControlMask, XK_Control_L); | 93 UnmaskAndSetKeycodeThenSend(&xevent, ControlMask, XK_Control_L); |
94 if (command) | 94 if (command) |
95 UnmaskAndSetKeycodeThenSend(&xevent, Mod4Mask, XK_Meta_L); | 95 UnmaskAndSetKeycodeThenSend(&xevent, Mod4Mask, XK_Super_L); |
David Tseng
2014/09/19 22:37:05
Could you explain this change? meta vs super_l and
dmazzoni
2014/09/22 06:04:04
You're right, they both work - I reverted the chan
| |
96 DCHECK(!xevent.xkey.state); | 96 DCHECK(!xevent.xkey.state); |
97 RunClosureAfterAllPendingUIEvents(closure); | 97 RunClosureAfterAllPendingUIEvents(closure); |
98 return true; | 98 return true; |
99 } | 99 } |
100 | 100 |
101 virtual bool SendMouseMove(long screen_x, long screen_y) OVERRIDE { | 101 virtual bool SendMouseMove(long screen_x, long screen_y) OVERRIDE { |
102 return SendMouseMoveNotifyWhenDone(screen_x, screen_y, base::Closure()); | 102 return SendMouseMoveNotifyWhenDone(screen_x, screen_y, base::Closure()); |
103 } | 103 } |
104 virtual bool SendMouseMoveNotifyWhenDone( | 104 virtual bool SendMouseMoveNotifyWhenDone( |
105 long screen_x, | 105 long screen_x, |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
225 }; | 225 }; |
226 | 226 |
227 } // namespace | 227 } // namespace |
228 | 228 |
229 UIControlsAura* CreateUIControlsAura(WindowTreeHost* host) { | 229 UIControlsAura* CreateUIControlsAura(WindowTreeHost* host) { |
230 return new UIControlsX11(host); | 230 return new UIControlsX11(host); |
231 } | 231 } |
232 | 232 |
233 } // namespace test | 233 } // namespace test |
234 } // namespace aura | 234 } // namespace aura |
OLD | NEW |