From b0b86b6b9d6798d04a320060e90bd8497a7f50f9 Mon Sep 17 00:00:00 2001 From: crupest Date: Sat, 20 Nov 2021 19:47:53 +0800 Subject: ... --- src/osx/gui/Window.mm | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'src/osx/gui') diff --git a/src/osx/gui/Window.mm b/src/osx/gui/Window.mm index a026a455..0112fd43 100644 --- a/src/osx/gui/Window.mm +++ b/src/osx/gui/Window.mm @@ -241,6 +241,11 @@ void OsxWindow::CreateWindow() { [p_->window_ setDelegate:p_->window_delegate_]; + if (p_->parent_) { + auto parent = CheckPlatform(p_->parent_, GetPlatformId()); + [p_->window_ setParentWindow:parent->p_->window_]; + } + NSView* content_view = [[CruView alloc] init:p_.get() input_context_p:p_->input_method_context_->p_.get() frame:Rect(Point{}, p_->content_rect_.GetSize())]; @@ -254,6 +259,12 @@ void OsxWindow::CreateWindow() { RequestRepaint(); } +bool OsxWindow::RequestFocus() { + if (!p_->window_) return false; + [p_->window_ makeKeyWindow]; + return true; +} + Point OsxWindow::GetMousePosition() { auto p = [p_->window_ mouseLocationOutsideOfEventStream]; return Point(p.x, p.y); -- cgit v1.2.3