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

Side by Side Diff: ui/events/cocoa/events_mac.mm

Issue 789763002: MacViews: Implement capture using NSEvent local+global monitors (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@20140812-MacViews-LAYERS2-PRESQUASH
Patch Set: NULL -> nullptr Created 6 years 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 | « no previous file | ui/gfx/mac/coordinate_conversion.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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_utils.h" 5 #include "ui/events/event_utils.h"
6 6
7 #include <Cocoa/Cocoa.h> 7 #include <Cocoa/Cocoa.h>
8 8
9 #import "base/mac/mac_util.h" 9 #import "base/mac/mac_util.h"
10 #import "base/mac/sdk_forward_declarations.h" 10 #import "base/mac/sdk_forward_declarations.h"
11 #include "base/logging.h" 11 #include "base/logging.h"
12 #include "base/time/time.h" 12 #include "base/time/time.h"
13 #include "build/build_config.h" 13 #include "build/build_config.h"
14 #include "ui/events/cocoa/cocoa_event_utils.h" 14 #include "ui/events/cocoa/cocoa_event_utils.h"
15 #include "ui/events/event_utils.h" 15 #include "ui/events/event_utils.h"
16 #import "ui/events/keycodes/keyboard_code_conversion_mac.h" 16 #import "ui/events/keycodes/keyboard_code_conversion_mac.h"
17 #import "ui/gfx/mac/coordinate_conversion.h"
17 #include "ui/gfx/point.h" 18 #include "ui/gfx/point.h"
18 #include "ui/gfx/vector2d.h" 19 #include "ui/gfx/vector2d.h"
19 20
20 namespace ui { 21 namespace ui {
21 22
22 void UpdateDeviceList() { 23 void UpdateDeviceList() {
23 NOTIMPLEMENTED(); 24 NOTIMPLEMENTED();
24 } 25 }
25 26
26 EventType EventTypeFromNative(const base::NativeEvent& native_event) { 27 EventType EventTypeFromNative(const base::NativeEvent& native_event) {
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 // Truncate to extract seconds before doing floating point arithmetic. 85 // Truncate to extract seconds before doing floating point arithmetic.
85 int64_t seconds = since_system_startup; 86 int64_t seconds = since_system_startup;
86 since_system_startup -= seconds; 87 since_system_startup -= seconds;
87 int64_t microseconds = since_system_startup * 1000000; 88 int64_t microseconds = since_system_startup * 1000000;
88 return base::TimeDelta::FromSeconds(seconds) + 89 return base::TimeDelta::FromSeconds(seconds) +
89 base::TimeDelta::FromMicroseconds(microseconds); 90 base::TimeDelta::FromMicroseconds(microseconds);
90 } 91 }
91 92
92 gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) { 93 gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) {
93 NSWindow* window = [native_event window]; 94 NSWindow* window = [native_event window];
94 if (!window) {
95 NOTIMPLEMENTED(); // Point will be in screen coordinates.
96 return gfx::Point();
97 }
98 NSPoint location = [native_event locationInWindow]; 95 NSPoint location = [native_event locationInWindow];
96 // When the window is nil, locationInWindow gives screen coordinates.
97 if (!window)
98 return gfx::ScreenPointFromNSPoint(location);
99
99 NSRect content_rect = [window contentRectForFrameRect:[window frame]]; 100 NSRect content_rect = [window contentRectForFrameRect:[window frame]];
100 return gfx::Point(location.x, NSHeight(content_rect) - location.y); 101 return gfx::Point(location.x, NSHeight(content_rect) - location.y);
101 } 102 }
102 103
103 gfx::Point EventSystemLocationFromNative( 104 gfx::Point EventSystemLocationFromNative(
104 const base::NativeEvent& native_event) { 105 const base::NativeEvent& native_event) {
105 NOTIMPLEMENTED(); 106 NOTIMPLEMENTED();
106 return gfx::Point(); 107 return gfx::Point();
107 } 108 }
108 109
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
265 uint16 return_value; 266 uint16 return_value;
266 [text getCharacters:&return_value]; 267 [text getCharacters:&return_value];
267 return return_value; 268 return return_value;
268 } 269 }
269 270
270 bool IsCharFromNative(const base::NativeEvent& native_event) { 271 bool IsCharFromNative(const base::NativeEvent& native_event) {
271 return false; 272 return false;
272 } 273 }
273 274
274 } // namespace ui 275 } // namespace ui
OLDNEW
« no previous file with comments | « no previous file | ui/gfx/mac/coordinate_conversion.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698