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

Unified Diff: ui/aura/root_window_host_linux.cc

Issue 12087124: Disable touch calibration on external touchscreen. (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: Review + Rebase on top of 12321086 Created 7 years, 9 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
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 48b1b27f2db9d94755a92a827bf314d6352266b4..b47342b8b2f12c5ded490fce109874a61f6c4468 100644
--- a/ui/aura/root_window_host_linux.cc
+++ b/ui/aura/root_window_host_linux.cc
@@ -61,14 +61,6 @@ namespace {
const int kBackMouseButton = 8;
const int kForwardMouseButton = 9;
-// These are the same values that are used to calibrate touch events in
-// |CalibrateTouchCoordinates| (in ui/base/x/events_x.cc).
-// TODO(sad|skuhne): Remove the duplication of values (http://crbug.com/147605)
-const int kXRootWindowPaddingLeft = 40;
-const int kXRootWindowPaddingRight = 40;
-const int kXRootWindowPaddingBottom = 30;
-const int kXRootWindowPaddingTop = 0;
-
const char* kAtomsToCache[] = {
"WM_DELETE_WINDOW",
"_NET_WM_PING",
@@ -175,13 +167,13 @@ 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 {
+class TouchEventRouter : public base::MessagePumpObserver {
public:
- TouchEventCalibrate() {
+ TouchEventRouter() {
MessageLoopForUI::current()->AddObserver(this);
}
- virtual ~TouchEventCalibrate() {
+ virtual ~TouchEventRouter() {
MessageLoopForUI::current()->RemoveObserver(this);
}
@@ -206,7 +198,7 @@ class TouchEventCalibrate : public base::MessagePumpObserver {
virtual void DidProcessEvent(const base::NativeEvent& event) OVERRIDE {
}
- DISALLOW_COPY_AND_ASSIGN(TouchEventCalibrate);
+ DISALLOW_COPY_AND_ASSIGN(TouchEventRouter);
};
} // namespace internal
@@ -265,7 +257,7 @@ RootWindowHostLinux::RootWindowHostLinux(const gfx::Rect& bounds)
bounds_(bounds),
is_internal_display_(false),
focus_when_shown_(false),
- touch_calibrate_(new internal::TouchEventCalibrate),
+ touch_router_(new internal::TouchEventRouter),
mouse_move_filter_(new MouseMoveFilter),
atom_cache_(xdisplay_, kAtomsToCache) {
XSetWindowAttributes swa;
@@ -904,24 +896,20 @@ void RootWindowHostLinux::DispatchXI2Event(const base::NativeEvent& event) {
ui::TouchEvent touchev(xev);
#if defined(OS_CHROMEOS)
if (base::chromeos::IsRunningOnChromeOS()) {
- if (!bounds_.Contains(touchev.location())) {
- // This might still be in the bezel region.
- gfx::Rect expanded(bounds_);
- expanded.Inset(-kXRootWindowPaddingLeft,
- -kXRootWindowPaddingTop,
- -kXRootWindowPaddingRight,
- -kXRootWindowPaddingBottom);
- if (!expanded.Contains(touchev.location()))
- break;
- }
+ if (!bounds_.Contains(touchev.location()))
+ break;
+ // X maps the touch-surface to the size of the X root-window.
+ // In multi-monitor setup, Coordinate Transformation Matrix
+ // repositions the touch-surface onto part of X root-window
+ // containing aura root-window corresponding to the touchscreen.
+ // However, if aura root-window has non-zero origin,
+ // we need to relocate the event into aura root-window coordinates.
+ touchev.Relocate(bounds_.origin());
+#if defined(USE_XI2_MT)
+ if (is_internal_display_)
+ touchev.Calibrate(bounds_);
+#endif
}
- // X maps the touch-surface to the size of the X root-window.
- // In multi-monitor setup, Coordinate Transformation Matrix
- // repositions the touch-surface onto part of X root-window
- // containing aura root-window corresponding to the touchscreen.
- // However, if aura root-window has non-zero origin,
- // we need to relocate the event into aura root-window coordinates.
- touchev.Relocate(bounds_.origin());
#endif // defined(OS_CHROMEOS)
delegate_->OnHostTouchEvent(&touchev);
break;
« no previous file with comments | « ui/aura/root_window_host_linux.h ('k') | ui/base/events/event.h » ('j') | ui/base/events/event.h » ('J')

Powered by Google App Engine
This is Rietveld 408576698