diff options
Diffstat (limited to 'platform')
-rw-r--r-- | platform/android/api/java_class_wrapper.h | 32 | ||||
-rw-r--r-- | platform/android/export/export.cpp | 3 | ||||
-rw-r--r-- | platform/android/java/lib/src/org/godotengine/godot/Godot.java | 3 | ||||
-rw-r--r-- | platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java | 4 | ||||
-rw-r--r-- | platform/iphone/export/export.cpp | 9 | ||||
-rw-r--r-- | platform/iphone/godot_iphone.cpp | 3 | ||||
-rw-r--r-- | platform/javascript/dom_keys.inc | 150 | ||||
-rw-r--r-- | platform/javascript/os_javascript.cpp | 71 | ||||
-rw-r--r-- | platform/linuxbsd/detect_prime_x11.cpp | 3 | ||||
-rw-r--r-- | platform/linuxbsd/display_server_x11.cpp | 12 | ||||
-rw-r--r-- | platform/linuxbsd/joypad_linux.cpp | 3 | ||||
-rw-r--r-- | platform/osx/display_server_osx.mm | 74 | ||||
-rw-r--r-- | platform/osx/joypad_osx.cpp | 9 | ||||
-rw-r--r-- | platform/uwp/export/export.cpp | 39 | ||||
-rw-r--r-- | platform/uwp/joypad_uwp.cpp | 3 | ||||
-rw-r--r-- | platform/uwp/os_uwp.cpp | 6 | ||||
-rw-r--r-- | platform/windows/display_server_windows.cpp | 18 | ||||
-rw-r--r-- | platform/windows/joypad_windows.cpp | 6 | ||||
-rw-r--r-- | platform/windows/windows_terminal_logger.cpp | 48 |
19 files changed, 344 insertions, 152 deletions
diff --git a/platform/android/api/java_class_wrapper.h b/platform/android/api/java_class_wrapper.h index 59fcd94b4d..3dfdc75cf4 100644 --- a/platform/android/api/java_class_wrapper.h +++ b/platform/android/api/java_class_wrapper.h @@ -83,9 +83,13 @@ class JavaClass : public Reference { switch (p_sig) { - case ARG_TYPE_VOID: r_type = Variant::NIL; break; + case ARG_TYPE_VOID: + r_type = Variant::NIL; + break; case ARG_TYPE_BOOLEAN | ARG_NUMBER_CLASS_BIT: - case ARG_TYPE_BOOLEAN: r_type = Variant::BOOL; break; + case ARG_TYPE_BOOLEAN: + r_type = Variant::BOOL; + break; case ARG_TYPE_BYTE | ARG_NUMBER_CLASS_BIT: case ARG_TYPE_BYTE: r_type = Variant::INT; @@ -121,10 +125,18 @@ class JavaClass : public Reference { r_type = Variant::FLOAT; likelihood = 0.5; break; - case ARG_TYPE_STRING: r_type = Variant::STRING; break; - case ARG_TYPE_CLASS: r_type = Variant::OBJECT; break; - case ARG_ARRAY_BIT | ARG_TYPE_VOID: r_type = Variant::NIL; break; - case ARG_ARRAY_BIT | ARG_TYPE_BOOLEAN: r_type = Variant::ARRAY; break; + case ARG_TYPE_STRING: + r_type = Variant::STRING; + break; + case ARG_TYPE_CLASS: + r_type = Variant::OBJECT; + break; + case ARG_ARRAY_BIT | ARG_TYPE_VOID: + r_type = Variant::NIL; + break; + case ARG_ARRAY_BIT | ARG_TYPE_BOOLEAN: + r_type = Variant::ARRAY; + break; case ARG_ARRAY_BIT | ARG_TYPE_BYTE: r_type = Variant::PACKED_BYTE_ARRAY; likelihood = 1.0; @@ -153,8 +165,12 @@ class JavaClass : public Reference { r_type = Variant::PACKED_FLOAT32_ARRAY; likelihood = 0.5; break; - case ARG_ARRAY_BIT | ARG_TYPE_STRING: r_type = Variant::PACKED_STRING_ARRAY; break; - case ARG_ARRAY_BIT | ARG_TYPE_CLASS: r_type = Variant::ARRAY; break; + case ARG_ARRAY_BIT | ARG_TYPE_STRING: + r_type = Variant::PACKED_STRING_ARRAY; + break; + case ARG_ARRAY_BIT | ARG_TYPE_CLASS: + r_type = Variant::ARRAY; + break; } } diff --git a/platform/android/export/export.cpp b/platform/android/export/export.cpp index d4fc52eaa9..f346ca54d2 100644 --- a/platform/android/export/export.cpp +++ b/platform/android/export/export.cpp @@ -372,7 +372,8 @@ class EditorExportPlatformAndroid : public EditorExportPlatform { } d.name = vendor + " " + device; - if (device == String()) continue; + if (device == String()) + continue; } ndevices.push_back(d); diff --git a/platform/android/java/lib/src/org/godotengine/godot/Godot.java b/platform/android/java/lib/src/org/godotengine/godot/Godot.java index 957f6223a9..ffe5402a54 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/Godot.java +++ b/platform/android/java/lib/src/org/godotengine/godot/Godot.java @@ -920,7 +920,8 @@ public abstract class Godot extends FragmentActivity implements SensorEventListe int cnt = 0; for (int i = cc.length; --i >= 0; cnt += cc[i] != 0 ? 1 : 0) ; - if (cnt == 0) return super.onKeyMultiple(inKeyCode, repeatCount, event); + if (cnt == 0) + return super.onKeyMultiple(inKeyCode, repeatCount, event); mRenderView.queueOnRenderThread(new Runnable() { // This method will be called on the rendering thread: public void run() { diff --git a/platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java b/platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java index b940d679f0..424251169b 100644 --- a/platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java +++ b/platform/android/java/lib/src/org/godotengine/godot/plugin/SignalInfo.java @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2019 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2019 Godot Engine contributors (cf. AUTHORS.md) */ +/* Copyright (c) 2007-2020 Juan Linietsky, Ariel Manzur. */ +/* Copyright (c) 2014-2020 Godot Engine contributors (cf. AUTHORS.md). */ /* */ /* Permission is hereby granted, free of charge, to any person obtaining */ /* a copy of this software and associated documentation files (the */ diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp index 3efe338ac7..2222a7f552 100644 --- a/platform/iphone/export/export.cpp +++ b/platform/iphone/export/export.cpp @@ -423,7 +423,8 @@ String EditorExportPlatformIOS::_get_linker_flags() { String result; for (int i = 0; i < export_plugins.size(); ++i) { String flags = export_plugins[i]->get_ios_linker_flags(); - if (flags.length() == 0) continue; + if (flags.length() == 0) + continue; if (result.length() > 0) { result += ' '; } @@ -456,8 +457,10 @@ void EditorExportPlatformIOS::_blend_and_rotate(Ref<Image> &p_dst, Ref<Image> &p int xs = (x_pos >= 0) ? 0 : -x_pos; int ys = (y_pos >= 0) ? 0 : -y_pos; - if (sw + x_pos > p_dst->get_width()) sw = p_dst->get_width() - x_pos; - if (sh + y_pos > p_dst->get_height()) sh = p_dst->get_height() - y_pos; + if (sw + x_pos > p_dst->get_width()) + sw = p_dst->get_width() - x_pos; + if (sh + y_pos > p_dst->get_height()) + sh = p_dst->get_height() - y_pos; for (int y = ys; y < sh; y++) { for (int x = xs; x < sw; x++) { diff --git a/platform/iphone/godot_iphone.cpp b/platform/iphone/godot_iphone.cpp index 3e67362e16..cea0e5c7f0 100644 --- a/platform/iphone/godot_iphone.cpp +++ b/platform/iphone/godot_iphone.cpp @@ -50,7 +50,8 @@ int iphone_main(int width, int height, int argc, char **argv, String data_dir) { size_t len = strlen(argv[0]); while (len--) { - if (argv[0][len] == '/') break; + if (argv[0][len] == '/') + break; } if (len >= 0) { diff --git a/platform/javascript/dom_keys.inc b/platform/javascript/dom_keys.inc index fd9df765d2..42d394fd4f 100644 --- a/platform/javascript/dom_keys.inc +++ b/platform/javascript/dom_keys.inc @@ -237,9 +237,12 @@ int dom2godot_keycode(int dom_keycode) { switch (dom_keycode) { //case DOM_VK_CANCEL: return KEY_UNKNOWN; - case DOM_VK_HELP: return KEY_HELP; - case DOM_VK_BACK_SPACE: return KEY_BACKSPACE; - case DOM_VK_TAB: return KEY_TAB; + case DOM_VK_HELP: + return KEY_HELP; + case DOM_VK_BACK_SPACE: + return KEY_BACKSPACE; + case DOM_VK_TAB: + return KEY_TAB; case DOM_VK_CLEAR: case DOM_VK_WIN_OEM_CLEAR: // OEM duplicate @@ -249,14 +252,17 @@ int dom2godot_keycode(int dom_keycode) { case DOM_VK_ENTER: // unused according to MDN return KEY_ENTER; - case DOM_VK_SHIFT: return KEY_SHIFT; - case DOM_VK_CONTROL: return KEY_CONTROL; + case DOM_VK_SHIFT: + return KEY_SHIFT; + case DOM_VK_CONTROL: + return KEY_CONTROL; case DOM_VK_ALT: case DOM_VK_ALTGR: return KEY_ALT; - case DOM_VK_PAUSE: return KEY_PAUSE; + case DOM_VK_PAUSE: + return KEY_PAUSE; case DOM_VK_CAPS_LOCK: return KEY_CAPSLOCK; @@ -279,14 +285,22 @@ int dom2godot_keycode(int dom_keycode) { case DOM_VK_MODECHANGE: return KEY_UNKNOWN; */ - case DOM_VK_SPACE: return KEY_SPACE; - case DOM_VK_PAGE_UP: return KEY_PAGEUP; - case DOM_VK_PAGE_DOWN: return KEY_PAGEDOWN; - case DOM_VK_END: return KEY_END; - case DOM_VK_HOME: return KEY_HOME; - case DOM_VK_LEFT: return KEY_LEFT; - case DOM_VK_UP: return KEY_UP; - case DOM_VK_RIGHT: return KEY_RIGHT; + case DOM_VK_SPACE: + return KEY_SPACE; + case DOM_VK_PAGE_UP: + return KEY_PAGEUP; + case DOM_VK_PAGE_DOWN: + return KEY_PAGEDOWN; + case DOM_VK_END: + return KEY_END; + case DOM_VK_HOME: + return KEY_HOME; + case DOM_VK_LEFT: + return KEY_LEFT; + case DOM_VK_UP: + return KEY_UP; + case DOM_VK_RIGHT: + return KEY_RIGHT; case DOM_VK_DOWN: return KEY_DOWN; @@ -297,24 +311,31 @@ int dom2godot_keycode(int dom_keycode) { return KEY_PRINT; //case DOM_VK_EXECUTE: return KEY_UNKNOWN; - case DOM_VK_INSERT: return KEY_INSERT; - case DOM_VK_DELETE: return KEY_DELETE; + case DOM_VK_INSERT: + return KEY_INSERT; + case DOM_VK_DELETE: + return KEY_DELETE; case DOM_VK_META: case DOM_VK_WIN: return KEY_META; - case DOM_VK_CONTEXT_MENU: return KEY_MENU; + case DOM_VK_CONTEXT_MENU: + return KEY_MENU; case DOM_VK_SLEEP: return KEY_STANDBY; // Numpad keys - case DOM_VK_MULTIPLY: return KEY_KP_MULTIPLY; - case DOM_VK_ADD: return KEY_KP_ADD; + case DOM_VK_MULTIPLY: + return KEY_KP_MULTIPLY; + case DOM_VK_ADD: + return KEY_KP_ADD; case DOM_VK_SEPARATOR: return KEY_KP_PERIOD; // Good enough? - case DOM_VK_SUBTRACT: return KEY_KP_SUBTRACT; - case DOM_VK_DECIMAL: return KEY_KP_PERIOD; + case DOM_VK_SUBTRACT: + return KEY_KP_SUBTRACT; + case DOM_VK_DECIMAL: + return KEY_KP_PERIOD; case DOM_VK_DIVIDE: return KEY_KP_DIVIDE; @@ -329,7 +350,8 @@ int dom2godot_keycode(int dom_keycode) { case DOM_VK_F24: return KEY_UNKNOWN; */ - case DOM_VK_NUM_LOCK: return KEY_NUMLOCK; + case DOM_VK_NUM_LOCK: + return KEY_NUMLOCK; case DOM_VK_SCROLL_LOCK: return KEY_SCROLLLOCK; @@ -341,40 +363,68 @@ int dom2godot_keycode(int dom_keycode) { case DOM_VK_WIN_OEM_FJ_ROYA: return KEY_UNKNOWN; */ - case DOM_VK_CIRCUMFLEX: return KEY_ASCIICIRCUM; - case DOM_VK_EXCLAMATION: return KEY_EXCLAM; - case DOM_VK_DOUBLE_QUOTE: return KEY_QUOTEDBL; - case DOM_VK_HASH: return KEY_NUMBERSIGN; - case DOM_VK_DOLLAR: return KEY_DOLLAR; - case DOM_VK_PERCENT: return KEY_PERCENT; - case DOM_VK_AMPERSAND: return KEY_AMPERSAND; - case DOM_VK_UNDERSCORE: return KEY_UNDERSCORE; - case DOM_VK_OPEN_PAREN: return KEY_PARENLEFT; - case DOM_VK_CLOSE_PAREN: return KEY_PARENRIGHT; - case DOM_VK_ASTERISK: return KEY_ASTERISK; - case DOM_VK_PLUS: return KEY_PLUS; - case DOM_VK_PIPE: return KEY_BAR; - case DOM_VK_HYPHEN_MINUS: return KEY_MINUS; - case DOM_VK_OPEN_CURLY_BRACKET: return KEY_BRACELEFT; - case DOM_VK_CLOSE_CURLY_BRACKET: return KEY_BRACERIGHT; - case DOM_VK_TILDE: return KEY_ASCIITILDE; + case DOM_VK_CIRCUMFLEX: + return KEY_ASCIICIRCUM; + case DOM_VK_EXCLAMATION: + return KEY_EXCLAM; + case DOM_VK_DOUBLE_QUOTE: + return KEY_QUOTEDBL; + case DOM_VK_HASH: + return KEY_NUMBERSIGN; + case DOM_VK_DOLLAR: + return KEY_DOLLAR; + case DOM_VK_PERCENT: + return KEY_PERCENT; + case DOM_VK_AMPERSAND: + return KEY_AMPERSAND; + case DOM_VK_UNDERSCORE: + return KEY_UNDERSCORE; + case DOM_VK_OPEN_PAREN: + return KEY_PARENLEFT; + case DOM_VK_CLOSE_PAREN: + return KEY_PARENRIGHT; + case DOM_VK_ASTERISK: + return KEY_ASTERISK; + case DOM_VK_PLUS: + return KEY_PLUS; + case DOM_VK_PIPE: + return KEY_BAR; + case DOM_VK_HYPHEN_MINUS: + return KEY_MINUS; + case DOM_VK_OPEN_CURLY_BRACKET: + return KEY_BRACELEFT; + case DOM_VK_CLOSE_CURLY_BRACKET: + return KEY_BRACERIGHT; + case DOM_VK_TILDE: + return KEY_ASCIITILDE; - case DOM_VK_VOLUME_MUTE: return KEY_VOLUMEMUTE; - case DOM_VK_VOLUME_DOWN: return KEY_VOLUMEDOWN; - case DOM_VK_VOLUME_UP: return KEY_VOLUMEUP; + case DOM_VK_VOLUME_MUTE: + return KEY_VOLUMEMUTE; + case DOM_VK_VOLUME_DOWN: + return KEY_VOLUMEDOWN; + case DOM_VK_VOLUME_UP: + return KEY_VOLUMEUP; - case DOM_VK_COMMA: return KEY_COMMA; - case DOM_VK_PERIOD: return KEY_PERIOD; - case DOM_VK_SLASH: return KEY_SLASH; - case DOM_VK_BACK_QUOTE: return KEY_QUOTELEFT; - case DOM_VK_OPEN_BRACKET: return KEY_BRACKETLEFT; - case DOM_VK_BACK_SLASH: return KEY_BACKSLASH; - case DOM_VK_CLOSE_BRACKET: return KEY_BRACKETRIGHT; + case DOM_VK_COMMA: + return KEY_COMMA; + case DOM_VK_PERIOD: + return KEY_PERIOD; + case DOM_VK_SLASH: + return KEY_SLASH; + case DOM_VK_BACK_QUOTE: + return KEY_QUOTELEFT; + case DOM_VK_OPEN_BRACKET: + return KEY_BRACKETLEFT; + case DOM_VK_BACK_SLASH: + return KEY_BACKSLASH; + case DOM_VK_CLOSE_BRACKET: + return KEY_BRACKETRIGHT; case DOM_VK_QUOTE: return KEY_APOSTROPHE; // The rest is OEM/unusual. - default: return KEY_UNKNOWN; + default: + return KEY_UNKNOWN; }; } diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp index c0230b94fa..90075df82e 100644 --- a/platform/javascript/os_javascript.cpp +++ b/platform/javascript/os_javascript.cpp @@ -324,12 +324,23 @@ EM_BOOL OS_JavaScript::mouse_button_callback(int p_event_type, const EmscriptenM dom2godot_mod(p_event, ev); switch (p_event->button) { - case DOM_BUTTON_LEFT: ev->set_button_index(BUTTON_LEFT); break; - case DOM_BUTTON_MIDDLE: ev->set_button_index(BUTTON_MIDDLE); break; - case DOM_BUTTON_RIGHT: ev->set_button_index(BUTTON_RIGHT); break; - case DOM_BUTTON_XBUTTON1: ev->set_button_index(BUTTON_XBUTTON1); break; - case DOM_BUTTON_XBUTTON2: ev->set_button_index(BUTTON_XBUTTON2); break; - default: return false; + case DOM_BUTTON_LEFT: + ev->set_button_index(BUTTON_LEFT); + break; + case DOM_BUTTON_MIDDLE: + ev->set_button_index(BUTTON_MIDDLE); + break; + case DOM_BUTTON_RIGHT: + ev->set_button_index(BUTTON_RIGHT); + break; + case DOM_BUTTON_XBUTTON1: + ev->set_button_index(BUTTON_XBUTTON1); + break; + case DOM_BUTTON_XBUTTON2: + ev->set_button_index(BUTTON_XBUTTON2); + break; + default: + return false; } if (ev->is_pressed()) { @@ -413,22 +424,38 @@ static const char *godot2dom_cursor(OS::CursorShape p_shape) { case OS::CURSOR_ARROW: default: return "auto"; - case OS::CURSOR_IBEAM: return "text"; - case OS::CURSOR_POINTING_HAND: return "pointer"; - case OS::CURSOR_CROSS: return "crosshair"; - case OS::CURSOR_WAIT: return "progress"; - case OS::CURSOR_BUSY: return "wait"; - case OS::CURSOR_DRAG: return "grab"; - case OS::CURSOR_CAN_DROP: return "grabbing"; - case OS::CURSOR_FORBIDDEN: return "no-drop"; - case OS::CURSOR_VSIZE: return "ns-resize"; - case OS::CURSOR_HSIZE: return "ew-resize"; - case OS::CURSOR_BDIAGSIZE: return "nesw-resize"; - case OS::CURSOR_FDIAGSIZE: return "nwse-resize"; - case OS::CURSOR_MOVE: return "move"; - case OS::CURSOR_VSPLIT: return "row-resize"; - case OS::CURSOR_HSPLIT: return "col-resize"; - case OS::CURSOR_HELP: return "help"; + case OS::CURSOR_IBEAM: + return "text"; + case OS::CURSOR_POINTING_HAND: + return "pointer"; + case OS::CURSOR_CROSS: + return "crosshair"; + case OS::CURSOR_WAIT: + return "progress"; + case OS::CURSOR_BUSY: + return "wait"; + case OS::CURSOR_DRAG: + return "grab"; + case OS::CURSOR_CAN_DROP: + return "grabbing"; + case OS::CURSOR_FORBIDDEN: + return "no-drop"; + case OS::CURSOR_VSIZE: + return "ns-resize"; + case OS::CURSOR_HSIZE: + return "ew-resize"; + case OS::CURSOR_BDIAGSIZE: + return "nesw-resize"; + case OS::CURSOR_FDIAGSIZE: + return "nwse-resize"; + case OS::CURSOR_MOVE: + return "move"; + case OS::CURSOR_VSPLIT: + return "row-resize"; + case OS::CURSOR_HSPLIT: + return "col-resize"; + case OS::CURSOR_HELP: + return "help"; } } diff --git a/platform/linuxbsd/detect_prime_x11.cpp b/platform/linuxbsd/detect_prime_x11.cpp index 1bec65ff04..1e46d3222d 100644 --- a/platform/linuxbsd/detect_prime_x11.cpp +++ b/platform/linuxbsd/detect_prime_x11.cpp @@ -178,7 +178,8 @@ int detect_prime() { close(fdset[0]); - if (i) setenv("DRI_PRIME", "1", 1); + if (i) + setenv("DRI_PRIME", "1", 1); create_context(); const char *vendor = (const char *)glGetString(GL_VENDOR); diff --git a/platform/linuxbsd/display_server_x11.cpp b/platform/linuxbsd/display_server_x11.cpp index dd9298d667..f016892453 100644 --- a/platform/linuxbsd/display_server_x11.cpp +++ b/platform/linuxbsd/display_server_x11.cpp @@ -551,7 +551,8 @@ int DisplayServerX11::get_screen_count() const { // Using Xinerama Extension int event_base, error_base; const Bool ext_okay = XineramaQueryExtension(x11_display, &event_base, &error_base); - if (!ext_okay) return 0; + if (!ext_okay) + return 0; int count; XineramaScreenInfo *xsi = XineramaQueryScreens(x11_display, &count); @@ -600,11 +601,13 @@ Rect2i DisplayServerX11::screen_get_usable_rect(int p_screen) const { // Using Xinerama Extension int event_base, error_base; const Bool ext_okay = XineramaQueryExtension(x11_display, &event_base, &error_base); - if (!ext_okay) return Rect2i(0, 0, 0, 0); + if (!ext_okay) + return Rect2i(0, 0, 0, 0); int count; XineramaScreenInfo *xsi = XineramaQueryScreens(x11_display, &count); - if (p_screen >= count) return Rect2i(0, 0, 0, 0); + if (p_screen >= count) + return Rect2i(0, 0, 0, 0); Rect2i rect = Rect2i(xsi[p_screen].x_org, xsi[p_screen].y_org, xsi[p_screen].width, xsi[p_screen].height); XFree(xsi); @@ -827,7 +830,8 @@ void DisplayServerX11::window_set_current_screen(int p_screen, WindowID p_window WindowData &wd = windows[p_window]; int count = get_screen_count(); - if (p_screen >= count) return; + if (p_screen >= count) + return; if (window_get_mode(p_window) == WINDOW_MODE_FULLSCREEN) { Point2i position = screen_get_position(p_screen); diff --git a/platform/linuxbsd/joypad_linux.cpp b/platform/linuxbsd/joypad_linux.cpp index 5ceea788e0..f57f74907f 100644 --- a/platform/linuxbsd/joypad_linux.cpp +++ b/platform/linuxbsd/joypad_linux.cpp @@ -463,7 +463,8 @@ void JoypadLinux::process_joypads() { } for (int i = 0; i < JOYPADS_MAX; i++) { - if (joypads[i].fd == -1) continue; + if (joypads[i].fd == -1) + continue; input_event events[32]; Joypad *joy = &joypads[i]; diff --git a/platform/osx/display_server_osx.mm b/platform/osx/display_server_osx.mm index 9d92992332..71e4584dac 100644 --- a/platform/osx/display_server_osx.mm +++ b/platform/osx/display_server_osx.mm @@ -1656,7 +1656,8 @@ String DisplayServerOSX::global_menu_get_item_submenu(const String &p_menu_root, const NSMenu *sub_menu = [menu_item submenu]; if (sub_menu) { for (Map<String, NSMenu *>::Element *E = submenu.front(); E; E = E->next()) { - if (E->get() == sub_menu) return E->key(); + if (E->get() == sub_menu) + return E->key(); } } } @@ -2479,7 +2480,8 @@ void DisplayServerOSX::_set_window_per_pixel_transparency_enabled(bool p_enabled ERR_FAIL_COND(!windows.has(p_window)); WindowData &wd = windows[p_window]; - if (!OS_OSX::get_singleton()->is_layered_allowed()) return; + if (!OS_OSX::get_singleton()->is_layered_allowed()) + return; if (wd.layered_window != p_enabled) { if (p_enabled) { [wd.window_object setBackgroundColor:[NSColor clearColor]]; @@ -2774,23 +2776,57 @@ void DisplayServerOSX::cursor_set_shape(CursorShape p_shape) { [cursors[p_shape] set]; } else { switch (p_shape) { - case CURSOR_ARROW: [[NSCursor arrowCursor] set]; break; - case CURSOR_IBEAM: [[NSCursor IBeamCursor] set]; break; - case CURSOR_POINTING_HAND: [[NSCursor pointingHandCursor] set]; break; - case CURSOR_CROSS: [[NSCursor crosshairCursor] set]; break; - case CURSOR_WAIT: [[NSCursor arrowCursor] set]; break; - case CURSOR_BUSY: [[NSCursor arrowCursor] set]; break; - case CURSOR_DRAG: [[NSCursor closedHandCursor] set]; break; - case CURSOR_CAN_DROP: [[NSCursor openHandCursor] set]; break; - case CURSOR_FORBIDDEN: [[NSCursor operationNotAllowedCursor] set]; break; - case CURSOR_VSIZE: [_cursorFromSelector(@selector(_windowResizeNorthSouthCursor), @selector(resizeUpDownCursor)) set]; break; - case CURSOR_HSIZE: [_cursorFromSelector(@selector(_windowResizeEastWestCursor), @selector(resizeLeftRightCursor)) set]; break; - case CURSOR_BDIAGSIZE: [_cursorFromSelector(@selector(_windowResizeNorthEastSouthWestCursor)) set]; break; - case CURSOR_FDIAGSIZE: [_cursorFromSelector(@selector(_windowResizeNorthWestSouthEastCursor)) set]; break; - case CURSOR_MOVE: [[NSCursor arrowCursor] set]; break; - case CURSOR_VSPLIT: [[NSCursor resizeUpDownCursor] set]; break; - case CURSOR_HSPLIT: [[NSCursor resizeLeftRightCursor] set]; break; - case CURSOR_HELP: [_cursorFromSelector(@selector(_helpCursor)) set]; break; + case CURSOR_ARROW: + [[NSCursor arrowCursor] set]; + break; + case CURSOR_IBEAM: + [[NSCursor IBeamCursor] set]; + break; + case CURSOR_POINTING_HAND: + [[NSCursor pointingHandCursor] set]; + break; + case CURSOR_CROSS: + [[NSCursor crosshairCursor] set]; + break; + case CURSOR_WAIT: + [[NSCursor arrowCursor] set]; + break; + case CURSOR_BUSY: + [[NSCursor arrowCursor] set]; + break; + case CURSOR_DRAG: + [[NSCursor closedHandCursor] set]; + break; + case CURSOR_CAN_DROP: + [[NSCursor openHandCursor] set]; + break; + case CURSOR_FORBIDDEN: + [[NSCursor operationNotAllowedCursor] set]; + break; + case CURSOR_VSIZE: + [_cursorFromSelector(@selector(_windowResizeNorthSouthCursor), @selector(resizeUpDownCursor)) set]; + break; + case CURSOR_HSIZE: + [_cursorFromSelector(@selector(_windowResizeEastWestCursor), @selector(resizeLeftRightCursor)) set]; + break; + case CURSOR_BDIAGSIZE: + [_cursorFromSelector(@selector(_windowResizeNorthEastSouthWestCursor)) set]; + break; + case CURSOR_FDIAGSIZE: + [_cursorFromSelector(@selector(_windowResizeNorthWestSouthEastCursor)) set]; + break; + case CURSOR_MOVE: + [[NSCursor arrowCursor] set]; + break; + case CURSOR_VSPLIT: + [[NSCursor resizeUpDownCursor] set]; + break; + case CURSOR_HSPLIT: + [[NSCursor resizeLeftRightCursor] set]; + break; + case CURSOR_HELP: + [_cursorFromSelector(@selector(_helpCursor)) set]; + break; default: { } } diff --git a/platform/osx/joypad_osx.cpp b/platform/osx/joypad_osx.cpp index 7f5ec05967..0f50ba63c6 100644 --- a/platform/osx/joypad_osx.cpp +++ b/platform/osx/joypad_osx.cpp @@ -374,7 +374,8 @@ bool joypad::check_ff_features() { if (ret == FF_OK && (features.supportedEffects & FFCAP_ET_CONSTANTFORCE)) { uint32_t val; ret = FFDeviceGetForceFeedbackProperty(ff_device, FFPROP_FFGAIN, &val, sizeof(val)); - if (ret != FF_OK) return false; + if (ret != FF_OK) + return false; int num_axes = features.numFfAxes; ff_axes = (DWORD *)memalloc(sizeof(DWORD) * num_axes); ff_directions = (LONG *)memalloc(sizeof(LONG) * num_axes); @@ -509,14 +510,16 @@ void JoypadOSX::joypad_vibration_stop(int p_id, uint64_t p_timestamp) { int JoypadOSX::get_joy_index(int p_id) const { for (int i = 0; i < device_list.size(); i++) { - if (device_list[i].id == p_id) return i; + if (device_list[i].id == p_id) + return i; } return -1; } int JoypadOSX::get_joy_ref(IOHIDDeviceRef p_device) const { for (int i = 0; i < device_list.size(); i++) { - if (device_list[i].device_ref == p_device) return i; + if (device_list[i].device_ref == p_device) + return i; } return -1; } diff --git a/platform/uwp/export/export.cpp b/platform/uwp/export/export.cpp index 06bf738dc1..f6618bfb47 100644 --- a/platform/uwp/export/export.cpp +++ b/platform/uwp/export/export.cpp @@ -265,7 +265,8 @@ void AppxPackager::make_content_types(const String &p_path) { String ext = file_metadata[i].name.get_extension(); - if (types.has(ext)) continue; + if (types.has(ext)) + continue; types[ext] = content_type(ext); @@ -664,8 +665,10 @@ class EditorExportPlatformUWP : public EditorExportPlatform { bool _valid_resource_name(const String &p_name) const { - if (p_name.empty()) return false; - if (p_name.ends_with(".")) return false; + if (p_name.empty()) + return false; + if (p_name.ends_with(".")) + return false; static const char *invalid_names[] = { "CON", "PRN", "AUX", "NUL", "COM1", "COM2", "COM3", "COM4", "COM5", "COM6", "COM7", @@ -675,7 +678,8 @@ class EditorExportPlatformUWP : public EditorExportPlatform { const char **t = invalid_names; while (*t) { - if (p_name == *t) return false; + if (p_name == *t) + return false; t++; } @@ -686,19 +690,25 @@ class EditorExportPlatformUWP : public EditorExportPlatform { Vector<String> parts = p_guid.split("-"); - if (parts.size() != 5) return false; - if (parts[0].length() != 8) return false; + if (parts.size() != 5) + return false; + if (parts[0].length() != 8) + return false; for (int i = 1; i < 4; i++) - if (parts[i].length() != 4) return false; - if (parts[4].length() != 12) return false; + if (parts[i].length() != 4) + return false; + if (parts[4].length() != 12) + return false; return true; } bool _valid_bgcolor(const String &p_color) const { - if (p_color.empty()) return true; - if (p_color.begins_with("#") && p_color.is_valid_html_color()) return true; + if (p_color.empty()) + return true; + if (p_color.begins_with("#") && p_color.is_valid_html_color()) + return true; // Colors from https://msdn.microsoft.com/en-us/library/windows/apps/dn934817.aspx static const char *valid_colors[] = { @@ -732,7 +742,8 @@ class EditorExportPlatformUWP : public EditorExportPlatform { const char **color = valid_colors; while (*color) { - if (p_color == *color) return true; + if (p_color == *color) + return true; color++; } @@ -896,7 +907,8 @@ class EditorExportPlatformUWP : public EditorExportPlatform { ERR_PRINT("Unable to load logo"); } - if (!image) return data; + if (!image) + return data; String tmp_path = EditorSettings::get_singleton()->get_cache_dir().plus_file("uwp_tmp_logo.png"); @@ -1301,7 +1313,8 @@ public: path = path.replace(".scale-100", ""); data = _get_image_data(p_preset, path); - if (data.size() > 0) do_read = false; + if (data.size() > 0) + do_read = false; } //read diff --git a/platform/uwp/joypad_uwp.cpp b/platform/uwp/joypad_uwp.cpp index 90df6fe5d7..93a9992706 100644 --- a/platform/uwp/joypad_uwp.cpp +++ b/platform/uwp/joypad_uwp.cpp @@ -48,7 +48,8 @@ void JoypadUWP::process_controllers() { ControllerDevice &joy = controllers[i]; - if (!joy.connected) break; + if (!joy.connected) + break; switch (joy.type) { diff --git a/platform/uwp/os_uwp.cpp b/platform/uwp/os_uwp.cpp index f5e989b370..1c83ebfdf7 100644 --- a/platform/uwp/os_uwp.cpp +++ b/platform/uwp/os_uwp.cpp @@ -123,7 +123,8 @@ bool OS_UWP::is_window_fullscreen() const { void OS_UWP::set_keep_screen_on(bool p_enabled) { - if (is_keep_screen_on() == p_enabled) return; + if (is_keep_screen_on() == p_enabled) + return; if (p_enabled) display_request->RequestActive(); @@ -826,7 +827,8 @@ void OS_UWP::run() { while (!force_quit) { CoreWindow::GetForCurrentThread()->Dispatcher->ProcessEvents(CoreProcessEventsOption::ProcessAllIfPresent); - if (managed_object->alert_close_handle) continue; + if (managed_object->alert_close_handle) + continue; process_events(); // get rid of pending events if (Main::iteration()) break; diff --git a/platform/windows/display_server_windows.cpp b/platform/windows/display_server_windows.cpp index 701cf69207..e794efb4fb 100644 --- a/platform/windows/display_server_windows.cpp +++ b/platform/windows/display_server_windows.cpp @@ -677,7 +677,8 @@ void DisplayServerWindows::window_set_position(const Point2i &p_position, Window ERR_FAIL_COND(!windows.has(p_window)); WindowData &wd = windows[p_window]; - if (wd.fullscreen) return; + if (wd.fullscreen) + return; #if 0 //wrong needs to account properly for decorations RECT r; @@ -1057,7 +1058,8 @@ void DisplayServerWindows::window_set_flag(WindowFlags p_flag, bool p_enabled, W wd.no_focus = p_enabled; _update_window_style(p_window); } break; - case WINDOW_FLAG_MAX: break; + case WINDOW_FLAG_MAX: + break; } } @@ -1088,7 +1090,8 @@ bool DisplayServerWindows::window_get_flag(WindowFlags p_flag, WindowID p_window return wd.no_focus; } break; - case WINDOW_FLAG_MAX: break; + case WINDOW_FLAG_MAX: + break; } return false; @@ -1474,19 +1477,22 @@ DisplayServer::LatinKeyboardVariant DisplayServerWindows::get_latin_keyboard_var int i = 0; while (azerty[i] != 0) { - if (azerty[i] == hex) return LATIN_KEYBOARD_AZERTY; + if (azerty[i] == hex) + return LATIN_KEYBOARD_AZERTY; i++; } i = 0; while (qwertz[i] != 0) { - if (qwertz[i] == hex) return LATIN_KEYBOARD_QWERTZ; + if (qwertz[i] == hex) + return LATIN_KEYBOARD_QWERTZ; i++; } i = 0; while (dvorak[i] != 0) { - if (dvorak[i] == hex) return LATIN_KEYBOARD_DVORAK; + if (dvorak[i] == hex) + return LATIN_KEYBOARD_DVORAK; i++; } diff --git a/platform/windows/joypad_windows.cpp b/platform/windows/joypad_windows.cpp index 2adf2a8652..8fdc92a79c 100644 --- a/platform/windows/joypad_windows.cpp +++ b/platform/windows/joypad_windows.cpp @@ -112,7 +112,8 @@ bool JoypadWindows::is_xinput_device(const GUID *p_guid) { return false; } dev_list = (PRAWINPUTDEVICELIST)malloc(sizeof(RAWINPUTDEVICELIST) * dev_list_count); - if (!dev_list) return false; + if (!dev_list) + return false; if (GetRawInputDeviceList(dev_list, &dev_list_count, sizeof(RAWINPUTDEVICELIST)) == (UINT)-1) { free(dev_list); @@ -267,7 +268,8 @@ void JoypadWindows::close_joypad(int id) { return; } - if (!d_joypads[id].attached) return; + if (!d_joypads[id].attached) + return; d_joypads[id].di_joy->Unacquire(); d_joypads[id].di_joy->Release(); diff --git a/platform/windows/windows_terminal_logger.cpp b/platform/windows/windows_terminal_logger.cpp index 884d95e082..3fb2adfd2c 100644 --- a/platform/windows/windows_terminal_logger.cpp +++ b/platform/windows/windows_terminal_logger.cpp @@ -89,20 +89,36 @@ void WindowsTerminalLogger::log_error(const char *p_function, const char *p_file uint32_t basecol = 0; switch (p_type) { - case ERR_ERROR: basecol = FOREGROUND_RED; break; - case ERR_WARNING: basecol = FOREGROUND_RED | FOREGROUND_GREEN; break; - case ERR_SCRIPT: basecol = FOREGROUND_RED | FOREGROUND_BLUE; break; - case ERR_SHADER: basecol = FOREGROUND_GREEN | FOREGROUND_BLUE; break; + case ERR_ERROR: + basecol = FOREGROUND_RED; + break; + case ERR_WARNING: + basecol = FOREGROUND_RED | FOREGROUND_GREEN; + break; + case ERR_SCRIPT: + basecol = FOREGROUND_RED | FOREGROUND_BLUE; + break; + case ERR_SHADER: + basecol = FOREGROUND_GREEN | FOREGROUND_BLUE; + break; } basecol |= current_bg; SetConsoleTextAttribute(hCon, basecol | FOREGROUND_INTENSITY); switch (p_type) { - case ERR_ERROR: logf("ERROR:"); break; - case ERR_WARNING: logf("WARNING:"); break; - case ERR_SCRIPT: logf("SCRIPT ERROR:"); break; - case ERR_SHADER: logf("SHADER ERROR:"); break; + case ERR_ERROR: + logf("ERROR:"); + break; + case ERR_WARNING: + logf("WARNING:"); + break; + case ERR_SCRIPT: + logf("SCRIPT ERROR:"); + break; + case ERR_SHADER: + logf("SHADER ERROR:"); + break; } SetConsoleTextAttribute(hCon, basecol); @@ -115,10 +131,18 @@ void WindowsTerminalLogger::log_error(const char *p_function, const char *p_file // `FOREGROUND_INTENSITY` alone results in gray text. SetConsoleTextAttribute(hCon, FOREGROUND_INTENSITY); switch (p_type) { - case ERR_ERROR: logf(" at: "); break; - case ERR_WARNING: logf(" at: "); break; - case ERR_SCRIPT: logf(" at: "); break; - case ERR_SHADER: logf(" at: "); break; + case ERR_ERROR: + logf(" at: "); + break; + case ERR_WARNING: + logf(" at: "); + break; + case ERR_SCRIPT: + logf(" at: "); + break; + case ERR_SHADER: + logf(" at: "); + break; } if (p_rationale && p_rationale[0]) { |