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

Unified Diff: ui/gfx/screen_mac.mm

Issue 1747803003: MacViews: Implement Tab Dragging (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Removed debug logging, use CGEvents for drag-n-drop. Created 4 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: ui/gfx/screen_mac.mm
diff --git a/ui/gfx/screen_mac.mm b/ui/gfx/screen_mac.mm
index 6fb7c6e8dc284f597a9f5cac0b9966d085968b97..c6de34f4bf572e1c1ad7019cc82b0613f0cb0fe0 100644
--- a/ui/gfx/screen_mac.mm
+++ b/ui/gfx/screen_mac.mm
@@ -16,6 +16,7 @@
#include "base/timer/timer.h"
#include "ui/gfx/display.h"
#include "ui/gfx/display_change_notifier.h"
+#include "ui/gfx/mac/coordinate_conversion.h"
namespace {
@@ -24,13 +25,7 @@ namespace {
const int64_t kConfigureDelayMs = 500;
gfx::Rect ConvertCoordinateSystem(NSRect ns_rect) {
- // Primary monitor is defined as the monitor with the menubar,
- // which is always at index 0.
- NSScreen* primary_screen = [[NSScreen screens] firstObject];
- float primary_screen_height = [primary_screen frame].size.height;
- gfx::Rect rect(NSRectToCGRect(ns_rect));
- rect.set_y(primary_screen_height - rect.y() - rect.height());
- return rect;
+ return gfx::ScreenRectFromNSRect(ns_rect);
}
NSScreen* GetMatchingScreen(const gfx::Rect& match_rect) {
@@ -105,9 +100,7 @@ class ScreenMac : public gfx::Screen {
gfx::Point GetCursorScreenPoint() override {
NSPoint mouseLocation = [NSEvent mouseLocation];
// Flip coordinates to gfx (0,0 in top-left corner) using primary screen.
- NSScreen* screen = [[NSScreen screens] firstObject];
- mouseLocation.y = NSMaxY([screen frame]) - mouseLocation.y;
- return gfx::Point(mouseLocation.x, mouseLocation.y);
+ return gfx::ScreenPointFromNSPoint(mouseLocation);
}
gfx::NativeWindow GetWindowUnderCursor() override {

Powered by Google App Engine
This is Rietveld 408576698