OLD | NEW |
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/root_window_host_x11.h" | 5 #include "ui/aura/root_window_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/Xfixes.h> | 9 #include <X11/extensions/Xfixes.h> |
10 #include <X11/extensions/XInput2.h> | 10 #include <X11/extensions/XInput2.h> |
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 // where they can be calibrated later. | 173 // where they can be calibrated later. |
174 // 2. Has the Calibrate method that does the actual bezel calibration, | 174 // 2. Has the Calibrate method that does the actual bezel calibration, |
175 // when invoked from X root window's event dispatcher. | 175 // when invoked from X root window's event dispatcher. |
176 class TouchEventCalibrate : public base::MessagePumpObserver { | 176 class TouchEventCalibrate : public base::MessagePumpObserver { |
177 public: | 177 public: |
178 TouchEventCalibrate() | 178 TouchEventCalibrate() |
179 : left_(0), | 179 : left_(0), |
180 right_(0), | 180 right_(0), |
181 top_(0), | 181 top_(0), |
182 bottom_(0) { | 182 bottom_(0) { |
183 MessageLoopForUI::current()->AddObserver(this); | 183 base::MessageLoopForUI::current()->AddObserver(this); |
184 #if defined(USE_XI2_MT) | 184 #if defined(USE_XI2_MT) |
185 std::vector<std::string> parts; | 185 std::vector<std::string> parts; |
186 if (Tokenize(CommandLine::ForCurrentProcess()->GetSwitchValueASCII( | 186 if (Tokenize(CommandLine::ForCurrentProcess()->GetSwitchValueASCII( |
187 switches::kTouchCalibration), ",", &parts) >= 4) { | 187 switches::kTouchCalibration), ",", &parts) >= 4) { |
188 if (!base::StringToInt(parts[0], &left_)) | 188 if (!base::StringToInt(parts[0], &left_)) |
189 DLOG(ERROR) << "Incorrect left border calibration value passed."; | 189 DLOG(ERROR) << "Incorrect left border calibration value passed."; |
190 if (!base::StringToInt(parts[1], &right_)) | 190 if (!base::StringToInt(parts[1], &right_)) |
191 DLOG(ERROR) << "Incorrect right border calibration value passed."; | 191 DLOG(ERROR) << "Incorrect right border calibration value passed."; |
192 if (!base::StringToInt(parts[2], &top_)) | 192 if (!base::StringToInt(parts[2], &top_)) |
193 DLOG(ERROR) << "Incorrect top border calibration value passed."; | 193 DLOG(ERROR) << "Incorrect top border calibration value passed."; |
194 if (!base::StringToInt(parts[3], &bottom_)) | 194 if (!base::StringToInt(parts[3], &bottom_)) |
195 DLOG(ERROR) << "Incorrect bottom border calibration value passed."; | 195 DLOG(ERROR) << "Incorrect bottom border calibration value passed."; |
196 } | 196 } |
197 #endif // defined(USE_XI2_MT) | 197 #endif // defined(USE_XI2_MT) |
198 } | 198 } |
199 | 199 |
200 virtual ~TouchEventCalibrate() { | 200 virtual ~TouchEventCalibrate() { |
201 MessageLoopForUI::current()->RemoveObserver(this); | 201 base::MessageLoopForUI::current()->RemoveObserver(this); |
202 } | 202 } |
203 | 203 |
204 // Modify the location of the |event|, | 204 // Modify the location of the |event|, |
205 // expanding it from |bounds| to (|bounds| + bezels). | 205 // expanding it from |bounds| to (|bounds| + bezels). |
206 // Required when touchscreen is bigger than screen (i.e. has bezels), | 206 // Required when touchscreen is bigger than screen (i.e. has bezels), |
207 // because we receive events in touchscreen coordinates, | 207 // because we receive events in touchscreen coordinates, |
208 // which need to be expanded when converting to screen coordinates, | 208 // which need to be expanded when converting to screen coordinates, |
209 // so that location on bezels will be outside of screen area. | 209 // so that location on bezels will be outside of screen area. |
210 void Calibrate(ui::TouchEvent* event, const gfx::Rect& bounds) { | 210 void Calibrate(ui::TouchEvent* event, const gfx::Rect& bounds) { |
211 #if defined(USE_XI2_MT) | 211 #if defined(USE_XI2_MT) |
(...skipping 922 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 return new RootWindowHostX11(bounds); | 1134 return new RootWindowHostX11(bounds); |
1135 } | 1135 } |
1136 | 1136 |
1137 // static | 1137 // static |
1138 gfx::Size RootWindowHost::GetNativeScreenSize() { | 1138 gfx::Size RootWindowHost::GetNativeScreenSize() { |
1139 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay(); | 1139 ::Display* xdisplay = base::MessagePumpAuraX11::GetDefaultXDisplay(); |
1140 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); | 1140 return gfx::Size(DisplayWidth(xdisplay, 0), DisplayHeight(xdisplay, 0)); |
1141 } | 1141 } |
1142 | 1142 |
1143 } // namespace aura | 1143 } // namespace aura |
OLD | NEW |