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

Side by Side Diff: ui/events/event.cc

Issue 197283008: Fix panel dragging on Linux Aura (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 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
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.h" 5 #include "ui/events/event.h"
6 6
7 #if defined(USE_X11) 7 #if defined(USE_X11)
8 #include <X11/extensions/XInput2.h> 8 #include <X11/extensions/XInput2.h>
9 #include <X11/Xlib.h> 9 #include <X11/Xlib.h>
10 #endif 10 #endif
(...skipping 13 matching lines...) Expand all
24 #if defined(USE_X11) 24 #if defined(USE_X11)
25 #include "ui/events/keycodes/keyboard_code_conversion_x.h" 25 #include "ui/events/keycodes/keyboard_code_conversion_x.h"
26 #elif defined(USE_OZONE) 26 #elif defined(USE_OZONE)
27 #include "ui/events/keycodes/keyboard_code_conversion.h" 27 #include "ui/events/keycodes/keyboard_code_conversion.h"
28 #endif 28 #endif
29 29
30 namespace { 30 namespace {
31 31
32 base::NativeEvent CopyNativeEvent(const base::NativeEvent& event) { 32 base::NativeEvent CopyNativeEvent(const base::NativeEvent& event) {
33 #if defined(USE_X11) 33 #if defined(USE_X11)
34 if (!event || event->type == GenericEvent) 34 if (!event)
35 return NULL; 35 return NULL;
36 XEvent* copy = new XEvent; 36 XEvent* copy = new XEvent;
37 *copy = *event; 37 *copy = *event;
38 if (event->type == GenericEvent) {
39 copy->xcookie.data = new XIDeviceEvent;
40 *(static_cast<XIDeviceEvent*>(copy->xcookie.data)) =
41 *(static_cast<XIDeviceEvent*>(event->xcookie.data));
42 }
38 return copy; 43 return copy;
39 #elif defined(OS_WIN) 44 #elif defined(OS_WIN)
40 return event; 45 return event;
41 #elif defined(USE_OZONE) 46 #elif defined(USE_OZONE)
42 return NULL; 47 return NULL;
43 #else 48 #else
44 NOTREACHED() << 49 NOTREACHED() <<
45 "Don't know how to copy base::NativeEvent for this platform"; 50 "Don't know how to copy base::NativeEvent for this platform";
46 return NULL; 51 return NULL;
47 #endif 52 #endif
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 118
114 } // namespace 119 } // namespace
115 120
116 namespace ui { 121 namespace ui {
117 122
118 //////////////////////////////////////////////////////////////////////////////// 123 ////////////////////////////////////////////////////////////////////////////////
119 // Event 124 // Event
120 125
121 Event::~Event() { 126 Event::~Event() {
122 #if defined(USE_X11) 127 #if defined(USE_X11)
123 if (delete_native_event_) 128 if (delete_native_event_) {
129 if (native_event_ && native_event_->type == GenericEvent)
130 delete static_cast<XIDeviceEvent*>(native_event_->xcookie.data);
124 delete native_event_; 131 delete native_event_;
132 }
125 #endif 133 #endif
126 } 134 }
127 135
128 bool Event::HasNativeEvent() const { 136 bool Event::HasNativeEvent() const {
129 base::NativeEvent null_event; 137 base::NativeEvent null_event;
130 std::memset(&null_event, 0, sizeof(null_event)); 138 std::memset(&null_event, 0, sizeof(null_event));
131 return !!std::memcmp(&native_event_, &null_event, sizeof(null_event)); 139 return !!std::memcmp(&native_event_, &null_event, sizeof(null_event));
132 } 140 }
133 141
134 void Event::StopPropagation() { 142 void Event::StopPropagation() {
(...skipping 596 matching lines...) Expand 10 before | Expand all | Expand 10 after
731 int GestureEvent::GetLowestTouchId() const { 739 int GestureEvent::GetLowestTouchId() const {
732 if (touch_ids_bitfield_ == 0) 740 if (touch_ids_bitfield_ == 0)
733 return -1; 741 return -1;
734 int i = -1; 742 int i = -1;
735 // Find the index of the least significant 1 bit 743 // Find the index of the least significant 1 bit
736 while (!(1 << ++i & touch_ids_bitfield_)); 744 while (!(1 << ++i & touch_ids_bitfield_));
737 return i; 745 return i;
738 } 746 }
739 747
740 } // namespace ui 748 } // namespace ui
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698