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 "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> |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 } // namespace | 43 } // namespace |
44 | 44 |
45 | 45 |
46 namespace remoting { | 46 namespace remoting { |
47 | 47 |
48 static void ProcessReply(XPointer thread, | 48 static void ProcessReply(XPointer thread, |
49 XRecordInterceptData* data) { | 49 XRecordInterceptData* data) { |
50 if (data->category == XRecordFromServer) { | 50 if (data->category == XRecordFromServer) { |
51 xEvent* event = reinterpret_cast<xEvent*>(data->data); | 51 xEvent* event = reinterpret_cast<xEvent*>(data->data); |
52 if (event->u.u.type == MotionNotify) { | 52 if (event->u.u.type == MotionNotify) { |
53 gfx::Point pos(event->u.keyButtonPointer.rootX, | 53 SkIPoint pos(SkIPoint::Make(event->u.keyButtonPointer.rootX, |
54 event->u.keyButtonPointer.rootY); | 54 event->u.keyButtonPointer.rootY)); |
55 reinterpret_cast<LocalInputMonitorThread*>(thread)->LocalMouseMoved(pos); | 55 reinterpret_cast<LocalInputMonitorThread*>(thread)->LocalMouseMoved(pos); |
56 } else { | 56 } else { |
57 reinterpret_cast<LocalInputMonitorThread*>(thread)->LocalKeyPressed( | 57 reinterpret_cast<LocalInputMonitorThread*>(thread)->LocalKeyPressed( |
58 event->u.u.detail, event->u.u.type == KeyPress); | 58 event->u.u.detail, event->u.u.type == KeyPress); |
59 } | 59 } |
60 } | 60 } |
61 XRecordFreeData(data); | 61 XRecordFreeData(data); |
62 } | 62 } |
63 | 63 |
64 LocalInputMonitorThread::LocalInputMonitorThread(ChromotingHost* host) | 64 LocalInputMonitorThread::LocalInputMonitorThread(ChromotingHost* host) |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
155 // Context must be disabled via the control channel because we can't send | 155 // Context must be disabled via the control channel because we can't send |
156 // any X protocol traffic over the data channel while it's recording. | 156 // any X protocol traffic over the data channel while it's recording. |
157 XRecordDisableContext(display_, scoper.context); | 157 XRecordDisableContext(display_, scoper.context); |
158 XFlush(display_); | 158 XFlush(display_); |
159 } | 159 } |
160 | 160 |
161 XCloseDisplay(display_); | 161 XCloseDisplay(display_); |
162 display_ = NULL; | 162 display_ = NULL; |
163 } | 163 } |
164 | 164 |
165 void LocalInputMonitorThread::LocalMouseMoved(const gfx::Point& pos) { | 165 void LocalInputMonitorThread::LocalMouseMoved(const SkIPoint& pos) { |
166 host_->LocalMouseMoved(pos); | 166 host_->LocalMouseMoved(pos); |
167 } | 167 } |
168 | 168 |
169 void LocalInputMonitorThread::LocalKeyPressed(int key_code, bool down) { | 169 void LocalInputMonitorThread::LocalKeyPressed(int key_code, bool down) { |
170 int key_sym = XKeycodeToKeysym(display_, key_code, 0); | 170 int key_sym = XKeycodeToKeysym(display_, key_code, 0); |
171 if (key_sym == XK_Control_L || key_sym == XK_Control_R) { | 171 if (key_sym == XK_Control_L || key_sym == XK_Control_R) { |
172 ctrl_pressed_ = down; | 172 ctrl_pressed_ = down; |
173 } else if (key_sym == XK_Alt_L || key_sym == XK_Alt_R) { | 173 } else if (key_sym == XK_Alt_L || key_sym == XK_Alt_R) { |
174 alt_pressed_ = down; | 174 alt_pressed_ = down; |
175 } else if (alt_pressed_ && ctrl_pressed_ && key_sym == XK_Escape && down) { | 175 } else if (alt_pressed_ && ctrl_pressed_ && key_sym == XK_Escape && down) { |
176 host_->Shutdown(NULL); | 176 host_->Shutdown(NULL); |
177 } | 177 } |
178 } | 178 } |
179 | 179 |
180 } // namespace remoting | 180 } // namespace remoting |
OLD | NEW |