diff options
author | crupest <crupest@outlook.com> | 2021-10-21 21:29:06 +0800 |
---|---|---|
committer | crupest <crupest@outlook.com> | 2021-10-21 21:29:06 +0800 |
commit | 6f1edc1604341b32e13371c8a4ad431e9a00cc87 (patch) | |
tree | 73b719af474789b14bfec9c7323c896a7927a45e /src/osx/gui/Window.mm | |
parent | 2d8237bf58ef0a9074d05aed2fe98d739f5e3bf0 (diff) | |
download | cru-6f1edc1604341b32e13371c8a4ad431e9a00cc87.tar.gz cru-6f1edc1604341b32e13371c8a4ad431e9a00cc87.tar.bz2 cru-6f1edc1604341b32e13371c8a4ad431e9a00cc87.zip |
...
Diffstat (limited to 'src/osx/gui/Window.mm')
-rw-r--r-- | src/osx/gui/Window.mm | 13 |
1 files changed, 9 insertions, 4 deletions
diff --git a/src/osx/gui/Window.mm b/src/osx/gui/Window.mm index 56a1405d..8e21518e 100644 --- a/src/osx/gui/Window.mm +++ b/src/osx/gui/Window.mm @@ -149,14 +149,14 @@ bool OsxWindow::IsVisible() { void OsxWindow::SetVisible(bool is_visible) { if (p_->window_) { if (is_visible) { - [p_->window_ orderFront:p_->window_]; + [p_->window_ orderFront:nil]; } else { - [p_->window_ orderOut:p_->window_]; + [p_->window_ orderOut:nil]; } } else { if (is_visible) { CreateWindow(); - [p_->window_ orderFront:p_->window_]; + [p_->window_ orderFront:nil]; } } } @@ -220,6 +220,7 @@ void OsxWindow::CreateWindow() { NSWindowStyleMask style_mask = CalcWindowStyleMask(p_->frame_); p_->window_ = [[CruWindow alloc] init:p_.get() contentRect:content_rect style:style_mask]; + Ensures(p_->window_); [p_->window_ setDelegate:p_->window_delegate_]; @@ -281,11 +282,14 @@ IInputMethodContext* OsxWindow::GetInputMethodContext() { return p_->input_metho defer:false]; _p = p; - [self setIgnoresMouseEvents:FALSE]; [self setAcceptsMouseMovedEvents:YES]; return self; } + +- (BOOL)canBecomeKeyWindow { + return YES; +} @end @implementation CruView { @@ -340,6 +344,7 @@ IInputMethodContext* OsxWindow::GetInputMethodContext() { return p_->input_metho - (void)mouseDown:(NSEvent*)event { // cru::log::TagDebug(u"CruView", u"Recieved mouse down."); + [[self window] makeKeyWindow]; cru::platform::gui::KeyModifier key_modifier; if (event.modifierFlags & NSEventModifierFlagControl) |