aboutsummaryrefslogtreecommitdiff
path: root/src/osx/gui/Window.mm
diff options
context:
space:
mode:
authorcrupest <crupest@outlook.com>2021-11-20 19:47:53 +0800
committercrupest <crupest@outlook.com>2021-11-20 19:47:53 +0800
commitb0b86b6b9d6798d04a320060e90bd8497a7f50f9 (patch)
treea6e3f3315a538791e1cbd4e799bc6268262feedb /src/osx/gui/Window.mm
parent2ad748a0fcb66398299886970cc9c40cc50b3cd0 (diff)
downloadcru-b0b86b6b9d6798d04a320060e90bd8497a7f50f9.tar.gz
cru-b0b86b6b9d6798d04a320060e90bd8497a7f50f9.tar.bz2
cru-b0b86b6b9d6798d04a320060e90bd8497a7f50f9.zip
...
Diffstat (limited to 'src/osx/gui/Window.mm')
-rw-r--r--src/osx/gui/Window.mm11
1 files changed, 11 insertions, 0 deletions
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<OsxWindow>(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);