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

Unified 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | ui/gfx/mac/coordinate_conversion.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/events/cocoa/events_mac.mm
diff --git a/ui/events/cocoa/events_mac.mm b/ui/events/cocoa/events_mac.mm
index 99d391645730a79dde870c18b9a3e2606377451b..53578d5a723439d3ad56a88ae973062d3d425d7f 100644
--- a/ui/events/cocoa/events_mac.mm
+++ b/ui/events/cocoa/events_mac.mm
@@ -14,6 +14,7 @@
#include "ui/events/cocoa/cocoa_event_utils.h"
#include "ui/events/event_utils.h"
#import "ui/events/keycodes/keyboard_code_conversion_mac.h"
+#import "ui/gfx/mac/coordinate_conversion.h"
#include "ui/gfx/point.h"
#include "ui/gfx/vector2d.h"
@@ -91,11 +92,11 @@ base::TimeDelta EventTimeFromNative(const base::NativeEvent& native_event) {
gfx::Point EventLocationFromNative(const base::NativeEvent& native_event) {
NSWindow* window = [native_event window];
- if (!window) {
- NOTIMPLEMENTED(); // Point will be in screen coordinates.
- return gfx::Point();
- }
NSPoint location = [native_event locationInWindow];
+ // When the window is nil, locationInWindow gives screen coordinates.
+ if (!window)
+ return gfx::ScreenPointFromNSPoint(location);
+
NSRect content_rect = [window contentRectForFrameRect:[window frame]];
return gfx::Point(location.x, NSHeight(content_rect) - location.y);
}
« 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