diff options
Diffstat (limited to 'platform/macos')
-rw-r--r-- | platform/macos/detect.py | 2 | ||||
-rw-r--r-- | platform/macos/display_server_macos.h | 2 | ||||
-rw-r--r-- | platform/macos/display_server_macos.mm | 30 | ||||
-rw-r--r-- | platform/macos/godot_main_macos.mm | 9 | ||||
-rw-r--r-- | platform/macos/key_mapping_macos.mm | 2 |
5 files changed, 19 insertions, 26 deletions
diff --git a/platform/macos/detect.py b/platform/macos/detect.py index e3c1f17b8f..ae8749354e 100644 --- a/platform/macos/detect.py +++ b/platform/macos/detect.py @@ -144,7 +144,7 @@ def configure(env: "Environment"): env["CC"] = basecmd + "cc" env["CXX"] = basecmd + "c++" else: - # there aren't any ccache wrappers available for OS X cross-compile, + # there aren't any ccache wrappers available for macOS cross-compile, # to enable caching we need to prepend the path to the ccache binary env["CC"] = ccache_path + " " + basecmd + "cc" env["CXX"] = ccache_path + " " + basecmd + "c++" diff --git a/platform/macos/display_server_macos.h b/platform/macos/display_server_macos.h index f7c5b0b847..638355a3a8 100644 --- a/platform/macos/display_server_macos.h +++ b/platform/macos/display_server_macos.h @@ -188,7 +188,7 @@ private: Variant tag; Callable callback; }; - Vector<MenuCall> deferred_menu_calls; + List<MenuCall> deferred_menu_calls; const NSMenu *_get_menu_root(const String &p_menu_root) const; NSMenu *_get_menu_root(const String &p_menu_root); diff --git a/platform/macos/display_server_macos.mm b/platform/macos/display_server_macos.mm index bcbba74b41..9ef1446ea3 100644 --- a/platform/macos/display_server_macos.mm +++ b/platform/macos/display_server_macos.mm @@ -130,7 +130,7 @@ DisplayServerMacOS::WindowID DisplayServerMacOS::_create_window(WindowMode p_mod wpos.x = CLAMP(wpos.x, srect.position.x, srect.position.x + srect.size.width - p_rect.size.width / 3); wpos.y = CLAMP(wpos.y, srect.position.y, srect.position.y + srect.size.height - p_rect.size.height / 3); } - // OS X native y-coordinate relative to _get_screens_origin() is negative, + // macOS native y-coordinate relative to _get_screens_origin() is negative, // Godot passes a positive value. wpos.y *= -1; wpos += _get_screens_origin(); @@ -329,7 +329,7 @@ Point2i DisplayServerMacOS::_get_screens_origin() const { // Returns the native top-left screen coordinate of the smallest rectangle // that encompasses all screens. Needed in get_screen_position(), // window_get_position, and window_set_position() - // to convert between OS X native screen coordinates and the ones expected by Godot. + // to convert between macOS native screen coordinates and the ones expected by Godot. if (displays_arrangement_dirty) { const_cast<DisplayServerMacOS *>(this)->_update_displays_arrangement(); @@ -342,7 +342,7 @@ Point2i DisplayServerMacOS::_get_native_screen_position(int p_screen) const { NSArray *screenArray = [NSScreen screens]; if ((NSUInteger)p_screen < [screenArray count]) { NSRect nsrect = [[screenArray objectAtIndex:p_screen] frame]; - // Return the top-left corner of the screen, for OS X the y starts at the bottom. + // Return the top-left corner of the screen, for macOS the y starts at the bottom. return Point2i(nsrect.origin.x, nsrect.origin.y + nsrect.size.height) * screen_get_max_scale(); } @@ -2127,7 +2127,7 @@ Point2i DisplayServerMacOS::screen_get_position(int p_screen) const { } Point2i position = _get_native_screen_position(p_screen) - _get_screens_origin(); - // OS X native y-coordinate relative to _get_screens_origin() is negative, + // macOS native y-coordinate relative to _get_screens_origin() is negative, // Godot expects a positive value. position.y *= -1; return position; @@ -2252,7 +2252,7 @@ Rect2i DisplayServerMacOS::screen_get_usable_rect(int p_screen) const { Color DisplayServerMacOS::screen_get_pixel(const Point2i &p_position) const { Point2i position = p_position; - // OS X native y-coordinate relative to _get_screens_origin() is negative, + // macOS native y-coordinate relative to _get_screens_origin() is negative, // Godot passes a positive value. position.y *= -1; position += _get_screens_origin(); @@ -2532,13 +2532,13 @@ Point2i DisplayServerMacOS::window_get_position(WindowID p_window) const { const NSRect nsrect = [wd.window_object convertRectToScreen:contentRect]; Point2i pos; - // Return the position of the top-left corner, for OS X the y starts at the bottom. + // Return the position of the top-left corner, for macOS the y starts at the bottom. const float scale = screen_get_max_scale(); pos.x = nsrect.origin.x; pos.y = (nsrect.origin.y + nsrect.size.height); pos *= scale; pos -= _get_screens_origin(); - // OS X native y-coordinate relative to _get_screens_origin() is negative, + // macOS native y-coordinate relative to _get_screens_origin() is negative, // Godot expects a positive value. pos.y *= -1; return pos; @@ -2553,13 +2553,13 @@ Point2i DisplayServerMacOS::window_get_position_with_decorations(WindowID p_wind const NSRect nsrect = [wd.window_object frame]; Point2i pos; - // Return the position of the top-left corner, for OS X the y starts at the bottom. + // Return the position of the top-left corner, for macOS the y starts at the bottom. const float scale = screen_get_max_scale(); pos.x = nsrect.origin.x; pos.y = (nsrect.origin.y + nsrect.size.height); pos *= scale; pos -= _get_screens_origin(); - // OS X native y-coordinate relative to _get_screens_origin() is negative, + // macOS native y-coordinate relative to _get_screens_origin() is negative, // Godot expects a positive value. pos.y *= -1; return pos; @@ -2576,7 +2576,7 @@ void DisplayServerMacOS::window_set_position(const Point2i &p_position, WindowID } Point2i position = p_position; - // OS X native y-coordinate relative to _get_screens_origin() is negative, + // macOS native y-coordinate relative to _get_screens_origin() is negative, // Godot passes a positive value. position.y *= -1; position += _get_screens_origin(); @@ -3521,14 +3521,16 @@ void DisplayServerMacOS::process_events() { } // Process "menu_callback"s. - for (MenuCall &E : deferred_menu_calls) { - Variant tag = E.tag; + while (List<MenuCall>::Element *call_p = deferred_menu_calls.front()) { + MenuCall call = call_p->get(); + deferred_menu_calls.pop_front(); // Remove before call to avoid infinite loop in case callback is using `process_events` (e.g. EditorProgress). + + Variant tag = call.tag; Variant *tagp = &tag; Variant ret; Callable::CallError ce; - E.callback.callp((const Variant **)&tagp, 1, ret, ce); + call.callback.callp((const Variant **)&tagp, 1, ret, ce); } - deferred_menu_calls.clear(); if (!drop_events) { _process_key_events(); diff --git a/platform/macos/godot_main_macos.mm b/platform/macos/godot_main_macos.mm index 29125c29a9..e98ab08127 100644 --- a/platform/macos/godot_main_macos.mm +++ b/platform/macos/godot_main_macos.mm @@ -53,21 +53,12 @@ int main(int argc, char **argv) { int first_arg = 1; const char *dbg_arg = "-NSDocumentRevisionsDebugMode"; - printf("arguments\n"); for (int i = 0; i < argc; i++) { if (strcmp(dbg_arg, argv[i]) == 0) { first_arg = i + 2; } - printf("%i: %s\n", i, argv[i]); } -#ifdef DEBUG_ENABLED - // Lets report the path we made current after all that. - char cwd[4096]; - getcwd(cwd, 4096); - printf("Current path: %s\n", cwd); -#endif - OS_MacOS os; Error err; diff --git a/platform/macos/key_mapping_macos.mm b/platform/macos/key_mapping_macos.mm index c3f147e33f..7f64ebb734 100644 --- a/platform/macos/key_mapping_macos.mm +++ b/platform/macos/key_mapping_macos.mm @@ -327,7 +327,7 @@ bool KeyMappingMacOS::is_numpad_key(unsigned int p_key) { return numpad_keys.has(p_key); } -// Translates a OS X keycode to a Godot keycode. +// Translates a macOS keycode to a Godot keycode. Key KeyMappingMacOS::translate_key(unsigned int p_key) { const Key *key = keysym_map.getptr(p_key); if (key) { |