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

Side by Side Diff: ui/events/x/events_x.cc

Issue 231883003: [stash] 20140404-crbug-312961-mac-views-bridge-C-wholegrid Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 8 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 | « ui/events/win/events_win.cc ('k') | ui/gfx/cursor.h » ('j') | 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/events/event_constants.h" 5 #include "ui/events/event_constants.h"
6 6
7 #include <cmath> 7 #include <cmath>
8 #include <string.h> 8 #include <string.h>
9 #include <X11/extensions/XInput.h> 9 #include <X11/extensions/XInput.h>
10 #include <X11/extensions/XInput2.h> 10 #include <X11/extensions/XInput2.h>
(...skipping 516 matching lines...) Expand 10 before | Expand all | Expand 10 after
527 return gfx::Vector2d(0, -kWheelScrollAmount); 527 return gfx::Vector2d(0, -kWheelScrollAmount);
528 case 6: 528 case 6:
529 return gfx::Vector2d(kWheelScrollAmount, 0); 529 return gfx::Vector2d(kWheelScrollAmount, 0);
530 case 7: 530 case 7:
531 return gfx::Vector2d(-kWheelScrollAmount, 0); 531 return gfx::Vector2d(-kWheelScrollAmount, 0);
532 default: 532 default:
533 return gfx::Vector2d(); 533 return gfx::Vector2d();
534 } 534 }
535 } 535 }
536 536
537 base::NativeEvent CopyNativeEvent(const base::NativeEvent& event) {
538 if (!event || event->type == GenericEvent)
539 return NULL;
540 XEvent* copy = new XEvent;
541 *copy = *event;
542 return copy;
543 }
544
545 void ReleaseCopiedNativeEvent(const base::NativeEvent& event) { delete event; }
546
537 void ClearTouchIdIfReleased(const base::NativeEvent& xev) { 547 void ClearTouchIdIfReleased(const base::NativeEvent& xev) {
538 ui::EventType type = ui::EventTypeFromNative(xev); 548 ui::EventType type = ui::EventTypeFromNative(xev);
539 if (type == ui::ET_TOUCH_CANCELLED || 549 if (type == ui::ET_TOUCH_CANCELLED ||
540 type == ui::ET_TOUCH_RELEASED) { 550 type == ui::ET_TOUCH_RELEASED) {
541 ui::TouchFactory* factory = ui::TouchFactory::GetInstance(); 551 ui::TouchFactory* factory = ui::TouchFactory::GetInstance();
542 ui::DeviceDataManager* manager = ui::DeviceDataManager::GetInstance(); 552 ui::DeviceDataManager* manager = ui::DeviceDataManager::GetInstance();
543 double tracking_id; 553 double tracking_id;
544 if (manager->GetEventData( 554 if (manager->GetEventData(
545 *xev, ui::DeviceDataManager::DT_TOUCH_TRACKING_ID, &tracking_id)) { 555 *xev, ui::DeviceDataManager::DT_TOUCH_TRACKING_ID, &tracking_id)) {
546 factory->ReleaseSlotForTrackingID(tracking_id); 556 factory->ReleaseSlotForTrackingID(tracking_id);
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 683
674 bool IsNaturalScrollEnabled() { 684 bool IsNaturalScrollEnabled() {
675 return DeviceDataManager::GetInstance()->natural_scroll_enabled(); 685 return DeviceDataManager::GetInstance()->natural_scroll_enabled();
676 } 686 }
677 687
678 bool IsTouchpadEvent(const base::NativeEvent& event) { 688 bool IsTouchpadEvent(const base::NativeEvent& event) {
679 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event); 689 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event);
680 } 690 }
681 691
682 } // namespace ui 692 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/win/events_win.cc ('k') | ui/gfx/cursor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698