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

Unified Diff: ui/aura/root_window_host_linux.cc

Issue 10933080: aura: More fix for touch-event calibration in multi-monito setting. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 3 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 | « ui/aura/root_window_host_linux.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/aura/root_window_host_linux.cc
diff --git a/ui/aura/root_window_host_linux.cc b/ui/aura/root_window_host_linux.cc
index 76ab200d0a47fabbad9d6ca1a218e29cd7736aff..8330652f91761d8bd250c18d80c593d92ef9dcef 100644
--- a/ui/aura/root_window_host_linux.cc
+++ b/ui/aura/root_window_host_linux.cc
@@ -14,6 +14,7 @@
#include <algorithm>
#include "base/command_line.h"
+#include "base/message_loop.h"
#include "base/message_pump_aurax11.h"
#include "base/stl_util.h"
#include "base/stringprintf.h"
@@ -280,6 +281,46 @@ bool ShouldSendCharEventForKeyboardCode(ui::KeyboardCode keycode) {
} // namespace
+namespace internal {
+
+// A very lightweight message-pump observer that routes all the touch events to
+// the X root window so that they can be calibrated properly.
+class TouchEventCalibrate : public base::MessagePumpObserver {
+ public:
+ TouchEventCalibrate() {
+ MessageLoopForUI::current()->AddObserver(this);
+ }
+
+ virtual ~TouchEventCalibrate() {
+ MessageLoopForUI::current()->RemoveObserver(this);
+ }
+
+ private:
+ // Overridden from base::MessagePumpObserver:
+ virtual base::EventStatus WillProcessEvent(
+ const base::NativeEvent& event) OVERRIDE {
+#if defined(USE_XI2_MT)
+ if (event->type == GenericEvent &&
+ (event->xgeneric.evtype == XI_TouchBegin ||
+ event->xgeneric.evtype == XI_TouchUpdate ||
+ event->xgeneric.evtype == XI_TouchEnd)) {
+ XIDeviceEvent* xievent = static_cast<XIDeviceEvent*>(event->xcookie.data);
+ xievent->event = xievent->root;
+ xievent->event_x = xievent->root_x;
+ xievent->event_y = xievent->root_y;
+ }
+#endif
+ return base::EVENT_CONTINUE;
+ }
+
+ virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE {
+ }
+
+ DISALLOW_COPY_AND_ASSIGN(TouchEventCalibrate);
+};
+
+}
Daniel Erat 2012/09/14 00:28:56 nit: // namespace internal
sadrul 2012/09/14 01:43:59 Done.
+
RootWindowHostLinux::RootWindowHostLinux(RootWindowHostDelegate* delegate,
const gfx::Rect& bounds)
: delegate_(delegate),
@@ -292,6 +333,7 @@ RootWindowHostLinux::RootWindowHostLinux(RootWindowHostDelegate* delegate,
bounds_(bounds),
focus_when_shown_(false),
pointer_barriers_(NULL),
+ touch_calibrate_(new internal::TouchEventCalibrate),
atom_cache_(xdisplay_, kAtomsToCache) {
XSetWindowAttributes swa;
memset(&swa, 0, sizeof(swa));
« no previous file with comments | « ui/aura/root_window_host_linux.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698