diff options
Diffstat (limited to 'platform/macos/display_server_macos.mm')
| -rw-r--r-- | platform/macos/display_server_macos.mm | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index 0989e47b19..290f0d487f 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -118,7 +118,7 @@ DisplayServerMacOS::WindowID DisplayServerMacOS::_create_window(WindowMode p_mod WindowData wd; wd.window_delegate = [[GodotWindowDelegate alloc] init]; - ERR_FAIL_COND_V_MSG(wd.window_delegate == nil, INVALID_WINDOW_ID, "Can't create a window delegate"); + ERR_FAIL_NULL_V_MSG(wd.window_delegate, INVALID_WINDOW_ID, "Can't create a window delegate"); [wd.window_delegate setWindowID:window_id_counter]; int rq_screen = get_screen_from_rect(p_rect); @@ -144,11 +144,11 @@ DisplayServerMacOS::WindowID DisplayServerMacOS::_create_window(WindowMode p_mod styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable backing:NSBackingStoreBuffered defer:NO]; - ERR_FAIL_COND_V_MSG(wd.window_object == nil, INVALID_WINDOW_ID, "Can't create a window"); + ERR_FAIL_NULL_V_MSG(wd.window_object, INVALID_WINDOW_ID, "Can't create a window"); [wd.window_object setWindowID:window_id_counter]; wd.window_view = [[GodotContentView alloc] init]; - ERR_FAIL_COND_V_MSG(wd.window_view == nil, INVALID_WINDOW_ID, "Can't create a window view"); + ERR_FAIL_NULL_V_MSG(wd.window_view, INVALID_WINDOW_ID, "Can't create a window view"); [wd.window_view setWindowID:window_id_counter]; [wd.window_view setWantsLayer:TRUE]; @@ -567,7 +567,7 @@ NSImage *DisplayServerMacOS::_convert_to_nsimg(Ref<Image> &p_image) const { colorSpaceName:NSDeviceRGBColorSpace bytesPerRow:int(p_image->get_width()) * 4 bitsPerPixel:32]; - ERR_FAIL_COND_V(imgrep == nil, nil); + ERR_FAIL_NULL_V(imgrep, nil); uint8_t *pixels = [imgrep bitmapData]; int len = p_image->get_width() * p_image->get_height(); @@ -583,7 +583,7 @@ NSImage *DisplayServerMacOS::_convert_to_nsimg(Ref<Image> &p_image) const { } NSImage *nsimg = [[NSImage alloc] initWithSize:NSMakeSize(p_image->get_width(), p_image->get_height())]; - ERR_FAIL_COND_V(nsimg == nil, nil); + ERR_FAIL_NULL_V(nsimg, nil); [nsimg addRepresentation:imgrep]; return nsimg; } @@ -1574,7 +1574,7 @@ void DisplayServerMacOS::global_menu_set_item_hover_callbacks(const String &p_me NSMenuItem *menu_item = [menu itemAtIndex:p_idx]; if (menu_item) { GodotMenuItem *obj = [menu_item representedObject]; - ERR_FAIL_COND(!obj); + ERR_FAIL_NULL(obj); obj->hover_callback = p_callback; } } @@ -3562,14 +3562,14 @@ bool DisplayServerMacOS::window_is_focused(WindowID p_window) const { } bool DisplayServerMacOS::window_can_draw(WindowID p_window) const { - return (window_get_mode(p_window) != WINDOW_MODE_MINIMIZED) && [windows[p_window].window_object isOnActiveSpace]; + return windows[p_window].is_visible; } bool DisplayServerMacOS::can_any_window_draw() const { _THREAD_SAFE_METHOD_ for (const KeyValue<WindowID, WindowData> &E : windows) { - if ((window_get_mode(E.key) != WINDOW_MODE_MINIMIZED) && [E.value.window_object isOnActiveSpace]) { + if (E.value.is_visible) { return true; } } @@ -3858,7 +3858,7 @@ void DisplayServerMacOS::cursor_set_custom_image(const Ref<Resource> &p_cursor, bytesPerRow:int(texture_size.width) * 4 bitsPerPixel:32]; - ERR_FAIL_COND(imgrep == nil); + ERR_FAIL_NULL(imgrep); uint8_t *pixels = [imgrep bitmapData]; int len = int(texture_size.width * texture_size.height); @@ -4124,7 +4124,7 @@ void DisplayServerMacOS::set_icon(const Ref<Image> &p_icon) { colorSpaceName:NSDeviceRGBColorSpace bytesPerRow:img->get_width() * 4 bitsPerPixel:32]; - ERR_FAIL_COND(imgrep == nil); + ERR_FAIL_NULL(imgrep); uint8_t *pixels = [imgrep bitmapData]; int len = img->get_width() * img->get_height(); @@ -4140,7 +4140,7 @@ void DisplayServerMacOS::set_icon(const Ref<Image> &p_icon) { } NSImage *nsimg = [[NSImage alloc] initWithSize:NSMakeSize(img->get_width(), img->get_height())]; - ERR_FAIL_COND(nsimg == nil); + ERR_FAIL_NULL(nsimg); [nsimg addRepresentation:imgrep]; [NSApp setApplicationIconImage:nsimg]; |
