From 24aaa8fbc5da8370506402facdb8ccaf563454e5 Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 15 Feb 2022 21:34:21 +0800 Subject: ... --- src/osx/gui/Window.mm | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'src/osx/gui') diff --git a/src/osx/gui/Window.mm b/src/osx/gui/Window.mm index 4f2937a3..e9de3ac7 100644 --- a/src/osx/gui/Window.mm +++ b/src/osx/gui/Window.mm @@ -168,14 +168,14 @@ Point OsxWindowPrivate::TransformMousePoint(const Point& point) { void OsxWindowPrivate::CreateWindow() { Expects(!window_); - NSRect content_rect = Convert(content_rect_); NSWindowStyleMask style_mask = CalcWindowStyleMask(style_flag_); - - auto cr = content_rect; - cr.origin.y = GetScreenSize().height - content_rect.origin.y - content_rect.size.height; - window_ = [[CruWindow alloc] init:this contentRect:cr style:style_mask]; + window_ = [[CruWindow alloc] init:this + contentRect:{0, 0, content_rect_.width, content_rect_.height} + style:style_mask]; Ensures(window_); + osx_window_->SetClientRect(content_rect_); + [window_ setDelegate:window_delegate_]; if (parent_) { @@ -193,7 +193,7 @@ void OsxWindowPrivate::CreateWindow() { [window_ setTitle:(NSString*)title_str]; CFRelease(title_str); - draw_layer_ = CreateLayer(content_rect.size); + draw_layer_ = CreateLayer(Convert(content_rect_.GetSize())); create_event_.Raise(nullptr); @@ -438,6 +438,10 @@ cru::platform::gui::KeyModifier GetKeyModifier(NSEvent* event) { return self; } +- (BOOL)canBecomeMainWindow { + return YES; +} + - (BOOL)canBecomeKeyWindow { return YES; } -- cgit v1.2.3