Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(808)

Side by Side Diff: remoting/host/event_executor_win.cc

Issue 6489031: Run event executor on the ui thread to remove the need to explicitly XFlush() the XTest calls. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: Removed unused gtk dependency. Created 9 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/event_executor_win.h" 5 #include "remoting/host/event_executor_win.h"
6 6
7 #include <windows.h> 7 #include <windows.h>
8 8
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/stl_util-inl.h" 10 #include "base/stl_util-inl.h"
11 #include "remoting/host/capturer.h" 11 #include "remoting/host/capturer.h"
12 #include "remoting/proto/event.pb.h" 12 #include "remoting/proto/event.pb.h"
13 #include "ui/base/keycodes/keyboard_codes.h" 13 #include "ui/base/keycodes/keyboard_codes.h"
14 14
15 namespace remoting { 15 namespace remoting {
16 16
17 using protocol::MouseEvent; 17 using protocol::MouseEvent;
18 using protocol::KeyEvent; 18 using protocol::KeyEvent;
19 19
20 EventExecutorWin::EventExecutorWin( 20 EventExecutorWin::EventExecutorWin(
21 MessageLoop* message_loop, Capturer* capturer) 21 MessageLoopForUI* message_loop, Capturer* capturer)
22 : message_loop_(message_loop), 22 : message_loop_(message_loop),
23 capturer_(capturer) { 23 capturer_(capturer) {
24 } 24 }
25 25
26 EventExecutorWin::~EventExecutorWin() { 26 EventExecutorWin::~EventExecutorWin() {
27 } 27 }
28 28
29 void EventExecutorWin::InjectKeyEvent(const KeyEvent* event, Task* done) { 29 void EventExecutorWin::InjectKeyEvent(const KeyEvent* event, Task* done) {
30 if (MessageLoop::current() != message_loop_) { 30 if (MessageLoop::current() != message_loop_) {
31 message_loop_->PostTask( 31 message_loop_->PostTask(
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
73 } 73 }
74 74
75 // Flag to mark keyup events. Default is keydown. 75 // Flag to mark keyup events. Default is keydown.
76 if (!down) { 76 if (!down) {
77 input.ki.dwFlags |= KEYEVENTF_KEYUP; 77 input.ki.dwFlags |= KEYEVENTF_KEYUP;
78 } 78 }
79 79
80 SendInput(1, &input, sizeof(INPUT)); 80 SendInput(1, &input, sizeof(INPUT));
81 } 81 }
82 82
83 protocol::InputStub* CreateEventExecutor(MessageLoop* message_loop, 83 protocol::InputStub* CreateEventExecutor(MessageLoopForUI* message_loop,
84 Capturer* capturer) { 84 Capturer* capturer) {
85 return new EventExecutorWin(message_loop, capturer); 85 return new EventExecutorWin(message_loop, capturer);
86 } 86 }
87 87
88 void EventExecutorWin::HandleMouse(const MouseEvent* event) { 88 void EventExecutorWin::HandleMouse(const MouseEvent* event) {
89 // TODO(garykac) Collapse mouse (x,y) and button events into a single 89 // TODO(garykac) Collapse mouse (x,y) and button events into a single
90 // input event when possible. 90 // input event when possible.
91 if (event->has_x() && event->has_y()) { 91 if (event->has_x() && event->has_y()) {
92 int x = event->x(); 92 int x = event->x();
93 int y = event->y(); 93 int y = event->y();
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 } else { 142 } else {
143 button_event.mi.dwFlags = 143 button_event.mi.dwFlags =
144 down ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_LEFTUP; 144 down ? MOUSEEVENTF_LEFTDOWN : MOUSEEVENTF_LEFTUP;
145 } 145 }
146 146
147 SendInput(1, &button_event, sizeof(INPUT)); 147 SendInput(1, &button_event, sizeof(INPUT));
148 } 148 }
149 } 149 }
150 150
151 } // namespace remoting 151 } // namespace remoting
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698