| OLD | NEW |
| 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 #import "ui/views/cocoa/bridged_native_widget.h" | 5 #import "ui/views/cocoa/bridged_native_widget.h" |
| 6 | 6 |
| 7 #import <objc/runtime.h> | 7 #import <objc/runtime.h> |
| 8 #include <stddef.h> | 8 #include <stddef.h> |
| 9 #include <stdint.h> | 9 #include <stdint.h> |
| 10 | 10 |
| (...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 89 | 89 |
| 90 // Margin at edge and corners of the window that trigger resizing. These match | 90 // Margin at edge and corners of the window that trigger resizing. These match |
| 91 // actual Cocoa resize margins. | 91 // actual Cocoa resize margins. |
| 92 const int kResizeAreaEdgeSize = 3; | 92 const int kResizeAreaEdgeSize = 3; |
| 93 const int kResizeAreaCornerSize = 12; | 93 const int kResizeAreaCornerSize = 12; |
| 94 | 94 |
| 95 int kWindowPropertiesKey; | 95 int kWindowPropertiesKey; |
| 96 | 96 |
| 97 float GetDeviceScaleFactorFromView(NSView* view) { | 97 float GetDeviceScaleFactorFromView(NSView* view) { |
| 98 gfx::Display display = | 98 gfx::Display display = |
| 99 gfx::Screen::GetScreenFor(view)->GetDisplayNearestWindow(view); | 99 gfx::Screen::GetScreen()->GetDisplayNearestWindow(view); |
| 100 DCHECK(display.is_valid()); | 100 DCHECK(display.is_valid()); |
| 101 return display.device_scale_factor(); | 101 return display.device_scale_factor(); |
| 102 } | 102 } |
| 103 | 103 |
| 104 // Returns true if bounds passed to window in SetBounds should be treated as | 104 // Returns true if bounds passed to window in SetBounds should be treated as |
| 105 // though they are in screen coordinates. | 105 // though they are in screen coordinates. |
| 106 bool PositionWindowInScreenCoordinates(views::Widget* widget, | 106 bool PositionWindowInScreenCoordinates(views::Widget* widget, |
| 107 views::Widget::InitParams::Type type) { | 107 views::Widget::InitParams::Type type) { |
| 108 // Replicate the logic in desktop_aura/desktop_screen_position_client.cc. | 108 // Replicate the logic in desktop_aura/desktop_screen_position_client.cc. |
| 109 if (views::GetAuraWindowTypeForWidgetType(type) == ui::wm::WINDOW_TYPE_POPUP) | 109 if (views::GetAuraWindowTypeForWidgetType(type) == ui::wm::WINDOW_TYPE_POPUP) |
| (...skipping 1101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1211 [bridged_view_ setMouseDownCanMoveWindow:draggable]; | 1211 [bridged_view_ setMouseDownCanMoveWindow:draggable]; |
| 1212 // AppKit will not update its cache of mouseDownCanMoveWindow unless something | 1212 // AppKit will not update its cache of mouseDownCanMoveWindow unless something |
| 1213 // changes. Previously we tried adding an NSView and removing it, but for some | 1213 // changes. Previously we tried adding an NSView and removing it, but for some |
| 1214 // reason it required reposting the mouse-down event, and didn't always work. | 1214 // reason it required reposting the mouse-down event, and didn't always work. |
| 1215 // Calling the below seems to be an effective solution. | 1215 // Calling the below seems to be an effective solution. |
| 1216 [window_ setMovableByWindowBackground:NO]; | 1216 [window_ setMovableByWindowBackground:NO]; |
| 1217 [window_ setMovableByWindowBackground:YES]; | 1217 [window_ setMovableByWindowBackground:YES]; |
| 1218 } | 1218 } |
| 1219 | 1219 |
| 1220 } // namespace views | 1220 } // namespace views |
| OLD | NEW |