summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--ui/base/ui_base_switches.cc3
-rw-r--r--ui/base/ui_base_switches.h1
-rw-r--r--ui/base/x/events_x.cc31
3 files changed, 22 insertions, 13 deletions
diff --git a/ui/base/ui_base_switches.cc b/ui/base/ui_base_switches.cc
index 545189e..663a8a4 100644
--- a/ui/base/ui_base_switches.cc
+++ b/ui/base/ui_base_switches.cc
@@ -22,6 +22,9 @@ const char kEnableBrowserTextSubpixelPositioning[] =
// Enable touch screen calibration.
const char kEnableTouchCalibration[] = "enable-touch-calibration";
+// Enable support for touch event calibration in x direction.
+const char kEnableTouchCalibrationX[] = "enable-touch-calibration-x";
+
// Enable support for touch events.
const char kEnableTouchEvents[] = "enable-touch-events";
diff --git a/ui/base/ui_base_switches.h b/ui/base/ui_base_switches.h
index 0f522ce..9b913d8 100644
--- a/ui/base/ui_base_switches.h
+++ b/ui/base/ui_base_switches.h
@@ -16,6 +16,7 @@ UI_EXPORT extern const char kEnableBezelTouch[];
UI_EXPORT extern const char kDisableScalingInImageSkiaOperations[];
UI_EXPORT extern const char kEnableBrowserTextSubpixelPositioning[];
UI_EXPORT extern const char kEnableTouchCalibration[];
+UI_EXPORT extern const char kEnableTouchCalibrationX[];
UI_EXPORT extern const char kEnableTouchEvents[];
UI_EXPORT extern const char kEnableViewsTextfield[];
UI_EXPORT extern const char kEnableWebkitTextSubpixelPositioning[];
diff --git a/ui/base/x/events_x.cc b/ui/base/x/events_x.cc
index 960dda4..dff3298 100644
--- a/ui/base/x/events_x.cc
+++ b/ui/base/x/events_x.cc
@@ -576,6 +576,9 @@ gfx::Point CalibrateTouchCoordinates(
if (!CommandLine::ForCurrentProcess()->HasSwitch(
switches::kEnableTouchCalibration))
return gfx::Point(x, y);
+ // Temporarily disabling the calibration for X.
+ bool calibration_x = CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableTouchCalibrationX);
gfx::Rect bounds = gfx::Screen::GetPrimaryDisplay().bounds_in_pixel();
const int kLeftBorder = 40;
const int kRightBorder = 40;
@@ -586,19 +589,21 @@ gfx::Point CalibrateTouchCoordinates(
// The "grace area" (10% in this case) is to make it easier for the user to
// navigate to the corner.
const double kGraceAreaFraction = 0.1;
- // Offset the x position to the real
- x -= kLeftBorder;
- // Check if we are in the grace area of the left side.
- // Note: We might not want to do this when the gesture is locked?
- if (x < 0 && x > -kLeftBorder * kGraceAreaFraction)
- x = 0;
- // Check if we are in the grace area of the right side.
- // Note: We might not want to do this when the gesture is locked?
- if (x > resolution_x - kLeftBorder &&
- x < resolution_x - kLeftBorder + kRightBorder * kGraceAreaFraction)
- x = resolution_x - kLeftBorder;
- // Scale the screen area back to the full resolution of the screen.
- x = (x * resolution_x) / (resolution_x - (kRightBorder + kLeftBorder));
+ if (calibration_x) {
+ // Offset the x position to the real
+ x -= kLeftBorder;
+ // Check if we are in the grace area of the left side.
+ // Note: We might not want to do this when the gesture is locked?
+ if (x < 0 && x > -kLeftBorder * kGraceAreaFraction)
+ x = 0;
+ // Check if we are in the grace area of the right side.
+ // Note: We might not want to do this when the gesture is locked?
+ if (x > resolution_x - kLeftBorder &&
+ x < resolution_x - kLeftBorder + kRightBorder * kGraceAreaFraction)
+ x = resolution_x - kLeftBorder;
+ // Scale the screen area back to the full resolution of the screen.
+ x = (x * resolution_x) / (resolution_x - (kRightBorder + kLeftBorder));
+ }
// When there is a top bezel we add our border,
y -= kTopBorder;
// and increase the sensitivity there.