Chromium Code Reviews| 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/Xlib.h> |
| 8 #include <X11/extensions/XInput2.h> | 8 #include <X11/extensions/XInput2.h> |
| 9 #include <string.h> | 9 #include <string.h> |
| 10 | 10 |
| (...skipping 331 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 342 // TODO(sad): Come up with a way to generate touch-ids for multi-touch | 342 // TODO(sad): Come up with a way to generate touch-ids for multi-touch |
| 343 // events when touch-events are generated from a single-touch device. | 343 // events when touch-events are generated from a single-touch device. |
| 344 return slot; | 344 return slot; |
| 345 } | 345 } |
| 346 | 346 |
| 347 #if defined(USE_XI2_MT) | 347 #if defined(USE_XI2_MT) |
| 348 float tracking_id; | 348 float tracking_id; |
| 349 if (!factory->ExtractTouchParam( | 349 if (!factory->ExtractTouchParam( |
| 350 *xev, ui::TouchFactory::TP_TRACKING_ID, &tracking_id)) | 350 *xev, ui::TouchFactory::TP_TRACKING_ID, &tracking_id)) |
| 351 LOG(ERROR) << "Could not get the slot ID for the event. Using 0."; | 351 LOG(ERROR) << "Could not get the slot ID for the event. Using 0."; |
| 352 else | 352 else { |
|
sadrul
2011/12/08 17:04:41
If you need brace in one, you should use them for
| |
| 353 slot = factory->GetSlotForTrackingID(tracking_id); | 353 slot = factory->GetSlotForTrackingID(tracking_id); |
| 354 ui::EventType type = ui::EventTypeFromNative(xev); | |
| 355 if (type == ui::ET_TOUCH_CANCELLED || | |
| 356 type == ui::ET_TOUCH_RELEASED) { | |
| 357 factory->ReleaseSlotForTrackingID(tracking_id); | |
| 358 } | |
| 359 } | |
| 354 #else | 360 #else |
| 355 if (!factory->ExtractTouchParam( | 361 if (!factory->ExtractTouchParam( |
| 356 *xev, ui::TouchFactory::TP_SLOT_ID, &slot)) | 362 *xev, ui::TouchFactory::TP_SLOT_ID, &slot)) |
| 357 LOG(ERROR) << "Could not get the slot ID for the event. Using 0."; | 363 LOG(ERROR) << "Could not get the slot ID for the event. Using 0."; |
| 358 #endif | 364 #endif |
| 359 return slot; | 365 return slot; |
| 360 } | 366 } |
| 361 | 367 |
| 362 float GetTouchRadiusX(const base::NativeEvent& native_event) { | 368 float GetTouchRadiusX(const base::NativeEvent& native_event) { |
| 363 return GetTouchParamFromXEvent(native_event, | 369 return GetTouchParamFromXEvent(native_event, |
| (...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 404 // Make sure we use atom from current xdisplay, which may | 410 // Make sure we use atom from current xdisplay, which may |
| 405 // change during the test. | 411 // change during the test. |
| 406 noop->xclient.message_type = XInternAtom( | 412 noop->xclient.message_type = XInternAtom( |
| 407 base::MessagePumpX::GetDefaultXDisplay(), | 413 base::MessagePumpX::GetDefaultXDisplay(), |
| 408 "noop", False); | 414 "noop", False); |
| 409 #endif | 415 #endif |
| 410 return noop; | 416 return noop; |
| 411 } | 417 } |
| 412 | 418 |
| 413 } // namespace ui | 419 } // namespace ui |
| OLD | NEW |