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

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

Issue 195793005: Refactor CopyNativeEvent and add events_mac.mm to start implementing stubs Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase at r263560 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 | Annotate | Revision Log
« no previous file with comments | « ui/events/win/events_win.cc ('k') | ui/gfx/gfx.gyp » ('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 118 matching lines...) Expand 10 before | Expand all | Expand 10 after
665 DeviceDataManager::GetInstance()->GetGestureTimes( 675 DeviceDataManager::GetInstance()->GetGestureTimes(
666 native_event, start_time, end_time); 676 native_event, start_time, end_time);
667 return true; 677 return true;
668 } 678 }
669 679
670 bool IsTouchpadEvent(const base::NativeEvent& event) { 680 bool IsTouchpadEvent(const base::NativeEvent& event) {
671 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event); 681 return DeviceDataManager::GetInstance()->IsTouchpadXInputEvent(event);
672 } 682 }
673 683
674 } // namespace ui 684 } // namespace ui
OLDNEW
« no previous file with comments | « ui/events/win/events_win.cc ('k') | ui/gfx/gfx.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698