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

Unified Diff: remoting/client/x11_input_handler.cc

Issue 3341005: Add mouse/keyboard event support to Chromoting client (Pepper and X11). (Closed) Base URL: http://src.chromium.org/git/chromium.git
Patch Set: review comments Created 10 years, 4 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « remoting/client/x11_input_handler.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: remoting/client/x11_input_handler.cc
diff --git a/remoting/client/x11_input_handler.cc b/remoting/client/x11_input_handler.cc
index f7900ca2d19d9e1d8b208e0b66f40f85f60a24f3..bd63af9077ba4ae63cf505ea55bed1e4af036689 100644
--- a/remoting/client/x11_input_handler.cc
+++ b/remoting/client/x11_input_handler.cc
@@ -12,6 +12,7 @@
// Include Xlib at the end because it clashes with Status in
// base/tracked_objects.h.
#include <X11/Xlib.h>
+#include <X11/Xutil.h>
namespace remoting {
@@ -42,7 +43,7 @@ void X11InputHandler::DoProcessX11Events() {
break;
case KeyPress:
case KeyRelease:
- // TODO(garykac) Implement.
+ HandleKeyEvent(&e);
break;
case ButtonPress:
HandleMouseButtonEvent(true, e.xbutton.button);
@@ -73,6 +74,15 @@ void X11InputHandler::ScheduleX11EventHandler() {
kProcessEventsInterval);
}
+void X11InputHandler::HandleKeyEvent(void* event) {
+ XEvent* e = reinterpret_cast<XEvent*>(event);
+ char buffer[128];
+ int buffsize = sizeof(buffer) - 1;
+ KeySym keysym;
+ XLookupString(&e->xkey, buffer, buffsize, &keysym, NULL);
+ SendKeyEvent(e->type == KeyPress, static_cast<int>(keysym));
+}
+
void X11InputHandler::HandleMouseMoveEvent(int x, int y) {
SendMouseMoveEvent(x, y);
}
« no previous file with comments | « remoting/client/x11_input_handler.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698