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

Side by Side Diff: ui/aura/window_tree_host_x11.cc

Issue 872033002: Remove no-op grace area touch calibration code (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ui/aura/window_tree_host_x11.h" 5 #include "ui/aura/window_tree_host_x11.h"
6 6
7 #include <strings.h> 7 #include <strings.h>
8 #include <X11/cursorfont.h> 8 #include <X11/cursorfont.h>
9 #include <X11/extensions/XInput2.h> 9 #include <X11/extensions/XInput2.h>
10 #include <X11/extensions/Xrandr.h> 10 #include <X11/extensions/Xrandr.h>
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 // which need to be expanded when converting to screen coordinates, 142 // which need to be expanded when converting to screen coordinates,
143 // so that location on bezels will be outside of screen area. 143 // so that location on bezels will be outside of screen area.
144 void Calibrate(ui::TouchEvent* event, const gfx::Rect& bounds) { 144 void Calibrate(ui::TouchEvent* event, const gfx::Rect& bounds) {
145 int x = event->x(); 145 int x = event->x();
146 int y = event->y(); 146 int y = event->y();
147 147
148 if (!left_ && !right_ && !top_ && !bottom_) 148 if (!left_ && !right_ && !top_ && !bottom_)
149 return; 149 return;
150 150
151 const int resolution_x = bounds.width(); 151 const int resolution_x = bounds.width();
152 const int resolution_y = bounds.height(); 152 const int resolution_y = bounds.height();
pkotwicz 2015/01/23 19:34:33 My understanding is that the following is always t
Mr4D (OOO till 08-26) 2015/01/27 13:35:45 This has to be enabled by the TP driver. It was me
153 // The "grace area" (10% in this case) is to make it easier for the user to
154 // navigate to the corner.
155 const double kGraceAreaFraction = 0.1;
156 if (left_ || right_) { 153 if (left_ || right_) {
157 // Offset the x position to the real 154 // Offset the x position to the real
158 x -= left_; 155 x -= left_;
159 // Check if we are in the grace area of the left side.
160 // Note: We might not want to do this when the gesture is locked?
161 if (x < 0 && x > -left_ * kGraceAreaFraction)
162 x = 0;
163 // Check if we are in the grace area of the right side.
164 // Note: We might not want to do this when the gesture is locked?
165 if (x > resolution_x - left_ &&
166 x < resolution_x - left_ + right_ * kGraceAreaFraction)
167 x = resolution_x - left_;
168 // Scale the screen area back to the full resolution of the screen. 156 // Scale the screen area back to the full resolution of the screen.
169 x = (x * resolution_x) / (resolution_x - (right_ + left_)); 157 x = (x * resolution_x) / (resolution_x - (right_ + left_));
170 } 158 }
171 if (top_ || bottom_) { 159 if (top_ || bottom_) {
172 // When there is a top bezel we add our border, 160 // When there is a top bezel we add our border,
173 y -= top_; 161 y -= top_;
174
175 // Check if we are in the grace area of the top side.
176 // Note: We might not want to do this when the gesture is locked?
177 if (y < 0 && y > -top_ * kGraceAreaFraction)
178 y = 0;
179
180 // Check if we are in the grace area of the bottom side.
181 // Note: We might not want to do this when the gesture is locked?
182 if (y > resolution_y - top_ &&
183 y < resolution_y - top_ + bottom_ * kGraceAreaFraction)
pkotwicz 2015/01/23 19:34:33 My understanding is that this if statement is neve
Mr4D (OOO till 08-26) 2015/01/27 13:35:45 At the moment only the bottom bezel is reliable. Y
184 y = resolution_y - top_;
185 // Scale the screen area back to the full resolution of the screen. 162 // Scale the screen area back to the full resolution of the screen.
186 y = (y * resolution_y) / (resolution_y - (bottom_ + top_)); 163 y = (y * resolution_y) / (resolution_y - (bottom_ + top_));
187 } 164 }
188 165
189 // Set the modified coordinate back to the event. 166 // Set the modified coordinate back to the event.
190 if (event->root_location() == event->location()) { 167 if (event->root_location() == event->location()) {
191 // Usually those will be equal, 168 // Usually those will be equal,
192 // if not, I am not sure what the correct value should be. 169 // if not, I am not sure what the correct value should be.
193 event->set_root_location(gfx::Point(x, y)); 170 event->set_root_location(gfx::Point(x, y));
194 } 171 }
(...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after
692 } 669 }
693 670
694 namespace test { 671 namespace test {
695 672
696 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) { 673 void SetUseOverrideRedirectWindowByDefault(bool override_redirect) {
697 default_override_redirect = override_redirect; 674 default_override_redirect = override_redirect;
698 } 675 }
699 676
700 } // namespace test 677 } // namespace test
701 } // namespace aura 678 } // namespace aura
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698