OLD | NEW |
---|---|
1 // Copyright (c) 2011 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 "remoting/host/local_input_monitor_thread_linux.h" | 5 #include "remoting/host/local_input_monitor_thread_linux.h" |
6 | 6 |
7 #include <sys/select.h> | 7 #include <sys/select.h> |
8 #include <unistd.h> | 8 #include <unistd.h> |
9 #define XK_MISCELLANY | 9 #define XK_MISCELLANY |
10 #include <X11/keysymdef.h> | 10 #include <X11/keysymdef.h> |
11 | 11 |
12 #include "base/basictypes.h" | 12 #include "base/basictypes.h" |
13 #include "base/eintr_wrapper.h" | 13 #include "base/eintr_wrapper.h" |
14 #include "remoting/host/chromoting_host.h" | 14 #include "remoting/host/chromoting_host.h" |
15 | 15 |
16 // These includes need to be later than dictated by the style guide due to | 16 // These includes need to be later than dictated by the style guide due to |
17 // Xlib header pollution, specifically the min, max, and Status macros. | 17 // Xlib header pollution, specifically the min, max, and Status macros. |
18 #include <X11/XKBlib.h> | |
18 #include <X11/Xlibint.h> | 19 #include <X11/Xlibint.h> |
19 #include <X11/extensions/record.h> | 20 #include <X11/extensions/record.h> |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 struct scoped_x_record_context { | 24 struct scoped_x_record_context { |
24 scoped_x_record_context() | 25 scoped_x_record_context() |
25 : data_channel(NULL), context(0) { | 26 : data_channel(NULL), context(0) { |
26 range[0] = range[1] = NULL; | 27 range[0] = range[1] = NULL; |
27 } | 28 } |
(...skipping 132 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
160 | 161 |
161 XCloseDisplay(display_); | 162 XCloseDisplay(display_); |
162 display_ = NULL; | 163 display_ = NULL; |
163 } | 164 } |
164 | 165 |
165 void LocalInputMonitorThread::LocalMouseMoved(const SkIPoint& pos) { | 166 void LocalInputMonitorThread::LocalMouseMoved(const SkIPoint& pos) { |
166 host_->LocalMouseMoved(pos); | 167 host_->LocalMouseMoved(pos); |
167 } | 168 } |
168 | 169 |
169 void LocalInputMonitorThread::LocalKeyPressed(int key_code, bool down) { | 170 void LocalInputMonitorThread::LocalKeyPressed(int key_code, bool down) { |
170 int key_sym = XKeycodeToKeysym(display_, key_code, 0); | 171 KeySym key_sym = XkbKeycodeToKeysym(display_, key_code, 0, 0); |
Lei Zhang
2012/03/21 23:16:43
Same as https://chromiumcodereview.appspot.com/963
| |
171 if (key_sym == XK_Control_L || key_sym == XK_Control_R) { | 172 if (key_sym == XK_Control_L || key_sym == XK_Control_R) { |
172 ctrl_pressed_ = down; | 173 ctrl_pressed_ = down; |
173 } else if (key_sym == XK_Alt_L || key_sym == XK_Alt_R) { | 174 } else if (key_sym == XK_Alt_L || key_sym == XK_Alt_R) { |
174 alt_pressed_ = down; | 175 alt_pressed_ = down; |
175 } else if (alt_pressed_ && ctrl_pressed_ && key_sym == XK_Escape && down) { | 176 } else if (alt_pressed_ && ctrl_pressed_ && key_sym == XK_Escape && down) { |
176 host_->Shutdown(base::Closure()); | 177 host_->Shutdown(base::Closure()); |
177 } | 178 } |
178 } | 179 } |
179 | 180 |
180 } // namespace remoting | 181 } // namespace remoting |
OLD | NEW |