OLD | NEW |
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 <Cocoa/Cocoa.h> | 5 #include <Cocoa/Cocoa.h> |
6 | 6 |
7 #include "ui/base/events.h" | 7 #include "ui/base/events.h" |
8 | 8 |
9 #include "base/logging.h" | 9 #include "base/logging.h" |
10 #include "base/time.h" | 10 #include "base/time.h" |
(...skipping 110 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 // would be to hit-test the view of the event and use the found view's | 121 // would be to hit-test the view of the event and use the found view's |
122 // coordinate system. Currently there is no need for this generality, and | 122 // coordinate system. Currently there is no need for this generality, and |
123 // speed is preferred. Flipped views are not suppported. | 123 // speed is preferred. Flipped views are not suppported. |
124 DCHECK([[window contentView] isFlipped] == NO); | 124 DCHECK([[window contentView] isFlipped] == NO); |
125 location = [[window contentView] convertPoint:location fromView:nil]; | 125 location = [[window contentView] convertPoint:location fromView:nil]; |
126 location.y = [[window contentView] bounds].size.height - location.y; | 126 location.y = [[window contentView] bounds].size.height - location.y; |
127 | 127 |
128 return gfx::Point(NSPointToCGPoint(location)); | 128 return gfx::Point(NSPointToCGPoint(location)); |
129 } | 129 } |
130 | 130 |
| 131 gfx::Point EventSystemLocationFromNative( |
| 132 const base::NativeEvent& native_event) { |
| 133 // TODO(port): Needs to always return screen position here. Returning normal |
| 134 // origin for now since that's obviously wrong. |
| 135 return gfx::Point(0, 0); |
| 136 } |
| 137 |
131 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { | 138 KeyboardCode KeyboardCodeFromNative(const base::NativeEvent& native_event) { |
132 return ui::KeyboardCodeFromNSEvent(native_event); | 139 return ui::KeyboardCodeFromNSEvent(native_event); |
133 } | 140 } |
134 | 141 |
135 bool IsMouseEvent(const base::NativeEvent& native_event) { | 142 bool IsMouseEvent(const base::NativeEvent& native_event) { |
136 EventType type = EventTypeFromNative(native_event); | 143 EventType type = EventTypeFromNative(native_event); |
137 return type == ET_MOUSE_PRESSED || | 144 return type == ET_MOUSE_PRESSED || |
138 type == ET_MOUSE_DRAGGED || | 145 type == ET_MOUSE_DRAGGED || |
139 type == ET_MOUSE_RELEASED || | 146 type == ET_MOUSE_RELEASED || |
140 type == ET_MOUSE_MOVED || | 147 type == ET_MOUSE_MOVED || |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
189 modifierFlags:0 | 196 modifierFlags:0 |
190 timestamp:[NSDate timeIntervalSinceReferenceDate] | 197 timestamp:[NSDate timeIntervalSinceReferenceDate] |
191 windowNumber:0 | 198 windowNumber:0 |
192 context:nil | 199 context:nil |
193 subtype:0 | 200 subtype:0 |
194 data1:0 | 201 data1:0 |
195 data2:0]; | 202 data2:0]; |
196 } | 203 } |
197 | 204 |
198 } // namespace ui | 205 } // namespace ui |
OLD | NEW |