summaryrefslogtreecommitdiff
path: root/platform/osx/os_osx.mm
diff options
context:
space:
mode:
Diffstat (limited to 'platform/osx/os_osx.mm')
-rw-r--r--platform/osx/os_osx.mm32
1 files changed, 21 insertions, 11 deletions
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index b45d0d80e6..fec524c04b 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -271,6 +271,8 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
- (void)windowDidExitFullScreen:(NSNotification *)notification {
OS_OSX::singleton->zoomed = false;
+ if (!OS_OSX::singleton->resizable)
+ [OS_OSX::singleton->window_object setStyleMask:[OS_OSX::singleton->window_object styleMask] & ~NSWindowStyleMaskResizable];
}
- (void)windowDidChangeBackingProperties:(NSNotification *)notification {
@@ -335,6 +337,11 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
}
- (void)windowDidMove:(NSNotification *)notification {
+
+ if (OS_OSX::singleton->get_main_loop()) {
+ OS_OSX::singleton->input->release_pressed_events();
+ }
+
/*
[window->nsgl.context update];
@@ -710,8 +717,6 @@ static void _mouseDownEvent(NSEvent *event, int index, int mask, bool pressed) {
if (OS_OSX::singleton->main_loop && OS_OSX::singleton->mouse_mode != OS::MOUSE_MODE_CAPTURED)
OS_OSX::singleton->main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_EXIT);
- if (OS_OSX::singleton->input)
- OS_OSX::singleton->input->set_mouse_in_window(false);
}
- (void)mouseEntered:(NSEvent *)event {
@@ -719,8 +724,6 @@ static void _mouseDownEvent(NSEvent *event, int index, int mask, bool pressed) {
return;
if (OS_OSX::singleton->main_loop && OS_OSX::singleton->mouse_mode != OS::MOUSE_MODE_CAPTURED)
OS_OSX::singleton->main_loop->notification(MainLoop::NOTIFICATION_WM_MOUSE_ENTER);
- if (OS_OSX::singleton->input)
- OS_OSX::singleton->input->set_mouse_in_window(true);
OS::CursorShape p_shape = OS_OSX::singleton->cursor_shape;
OS_OSX::singleton->cursor_shape = OS::CURSOR_MAX;
@@ -967,10 +970,10 @@ static const _KeyCodeMap _keycodes[55] = {
{ 'i', KEY_I },
{ 'o', KEY_O },
{ 'p', KEY_P },
- { '[', KEY_BRACERIGHT },
- { ']', KEY_BRACELEFT },
- { '{', KEY_BRACERIGHT },
- { '}', KEY_BRACELEFT },
+ { '[', KEY_BRACELEFT },
+ { ']', KEY_BRACERIGHT },
+ { '{', KEY_BRACELEFT },
+ { '}', KEY_BRACERIGHT },
{ 'a', KEY_A },
{ 's', KEY_S },
{ 'd', KEY_D },
@@ -1694,6 +1697,11 @@ void OS_OSX::set_cursor_shape(CursorShape p_shape) {
cursor_shape = p_shape;
}
+OS::CursorShape OS_OSX::get_cursor_shape() const {
+
+ return cursor_shape;
+}
+
void OS_OSX::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
if (p_cursor.is_valid()) {
Ref<Texture> texture = p_cursor;
@@ -2270,12 +2278,12 @@ Size2 OS_OSX::get_window_size() const {
Size2 OS_OSX::get_real_window_size() const {
NSRect frame = [window_object frame];
- return Size2(frame.size.width, frame.size.height);
+ return Size2(frame.size.width, frame.size.height) * _display_scale();
}
void OS_OSX::set_window_size(const Size2 p_size) {
- Size2 size = p_size;
+ Size2 size = p_size / _display_scale();
if (get_borderless_window() == false) {
// NSRect used by setFrame includes the title bar, so add it to our size.y
@@ -2300,6 +2308,8 @@ void OS_OSX::set_window_fullscreen(bool p_enabled) {
if (zoomed != p_enabled) {
if (layered_window)
set_window_per_pixel_transparency_enabled(false);
+ if (!resizable)
+ [window_object setStyleMask:[window_object styleMask] | NSWindowStyleMaskResizable];
[window_object toggleFullScreen:nil];
}
zoomed = p_enabled;
@@ -2314,7 +2324,7 @@ void OS_OSX::set_window_resizable(bool p_enabled) {
if (p_enabled)
[window_object setStyleMask:[window_object styleMask] | NSWindowStyleMaskResizable];
- else
+ else if (!zoomed)
[window_object setStyleMask:[window_object styleMask] & ~NSWindowStyleMaskResizable];
resizable = p_enabled;