InputCommon:QuarzKB&M: Use view position instead of window position

This commit is contained in:
TellowKrinkle 2022-08-12 03:06:33 -05:00
parent 798b241832
commit 588c4bd635
1 changed files with 3 additions and 1 deletions

View File

@ -23,6 +23,7 @@
@implementation DolWindowPositionObserver @implementation DolWindowPositionObserver
{ {
NSView* _view;
NSWindow* _window; NSWindow* _window;
NSRect _frame; NSRect _frame;
std::mutex _mtx; std::mutex _mtx;
@ -30,7 +31,7 @@
- (NSRect)calcFrame - (NSRect)calcFrame
{ {
return [_window frame]; return [_window convertRectToScreen:[_view frame]];
} }
- (instancetype)initWithView:(NSView*)view - (instancetype)initWithView:(NSView*)view
@ -38,6 +39,7 @@
self = [super init]; self = [super init];
if (self) if (self)
{ {
_view = view;
_window = [view window]; _window = [view window];
_frame = [self calcFrame]; _frame = [self calcFrame];
[_window addObserver:self forKeyPath:@"frame" options:0 context:nil]; [_window addObserver:self forKeyPath:@"frame" options:0 context:nil];