OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/base/events.h" | 5 #include "ui/base/events.h" |
6 | 6 |
| 7 #include <X11/Xlib.h> |
7 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
8 | 9 |
9 #include "base/logging.h" | 10 #include "base/logging.h" |
10 #include "ui/base/keycodes/keyboard_code_conversion_x.h" | 11 #include "ui/base/keycodes/keyboard_code_conversion_x.h" |
11 #include "ui/base/touch/touch_factory.h" | 12 #include "ui/base/touch/touch_factory.h" |
12 #include "ui/gfx/point.h" | 13 #include "ui/gfx/point.h" |
13 | 14 |
14 namespace { | 15 namespace { |
15 | 16 |
16 // Scroll amount for each wheelscroll event. 53 is also the value used for GTK+. | 17 // Scroll amount for each wheelscroll event. 53 is also the value used for GTK+. |
(...skipping 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
347 0.0); | 348 0.0); |
348 unsigned int deviceid = | 349 unsigned int deviceid = |
349 static_cast<XIDeviceEvent*>(native_event->xcookie.data)->sourceid; | 350 static_cast<XIDeviceEvent*>(native_event->xcookie.data)->sourceid; |
350 // Force is normalized to fall into [0, 1] | 351 // Force is normalized to fall into [0, 1] |
351 if (!ui::TouchFactory::GetInstance()->NormalizeTouchParam( | 352 if (!ui::TouchFactory::GetInstance()->NormalizeTouchParam( |
352 deviceid, ui::TouchFactory::TP_PRESSURE, &force)) | 353 deviceid, ui::TouchFactory::TP_PRESSURE, &force)) |
353 force = 0.0; | 354 force = 0.0; |
354 return force; | 355 return force; |
355 } | 356 } |
356 | 357 |
| 358 base::NativeEvent CreateNoopEvent() { |
| 359 static XEvent* noop = new XEvent(); |
| 360 noop->xclient.type = ClientMessage; |
| 361 noop->xclient.display = NULL; |
| 362 noop->xclient.window = None; |
| 363 noop->xclient.message_type = 0; |
| 364 noop->xclient.format = 0; |
| 365 return noop; |
| 366 } |
| 367 |
357 } // namespace ui | 368 } // namespace ui |
OLD | NEW |