Skip to content

Commit 65a3ec3

Browse files
committed
avoid using [NSWindow convertPointFromScreen:]
1 parent a007c02 commit 65a3ec3

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

ui/base/cocoa/menu_utils.mm

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,14 @@
44

55
#include "ui/base/cocoa/menu_utils.h"
66

7-
#include <optional>
8-
97
#import <AppKit/AppKit.h>
108

9+
#include <optional>
10+
1111
#import "base/mac/scoped_sending_event.h"
1212
#import "base/message_loop/message_pump_apple.h"
1313
#include "base/task/current_thread.h"
14+
#include "ui/base/cocoa/cocoa_base_utils.h"
1415
#include "ui/base/interaction/element_tracker_mac.h"
1516
#include "ui/gfx/mac/coordinate_conversion.h"
1617

@@ -19,7 +20,7 @@
1920
NSEvent* EventForPositioningContextMenu(const gfx::Point& anchor,
2021
NSWindow* window) {
2122
NSPoint location_in_window =
22-
[window convertPointFromScreen:gfx::ScreenPointToNSPoint(anchor)];
23+
ui::ConvertPointFromScreenToWindow(window, gfx::ScreenPointToNSPoint(anchor));
2324
return EventForPositioningContextMenuRelativeToWindow(location_in_window,
2425
window);
2526
}

0 commit comments

Comments
 (0)