summaryrefslogtreecommitdiff
path: root/platform
diff options
context:
space:
mode:
Diffstat (limited to 'platform')
-rw-r--r--platform/android/build.gradle.template2
-rw-r--r--platform/android/java/src/org/godotengine/godot/Godot.java5
-rw-r--r--platform/android/java/src/org/godotengine/godot/GodotView.java2
-rw-r--r--platform/android/os_android.cpp32
-rw-r--r--platform/iphone/export/export.cpp2
-rw-r--r--platform/javascript/detect.py10
-rw-r--r--platform/javascript/engine.js10
-rw-r--r--platform/javascript/javascript_main.cpp2
-rw-r--r--platform/javascript/os_javascript.cpp14
-rw-r--r--platform/javascript/os_javascript.h1
-rw-r--r--platform/osx/detect.py4
-rw-r--r--platform/osx/os_osx.mm147
-rw-r--r--platform/server/detect.py2
-rw-r--r--platform/windows/detect.py2
-rw-r--r--platform/windows/os_windows.cpp1
-rw-r--r--platform/x11/detect.py2
16 files changed, 127 insertions, 111 deletions
diff --git a/platform/android/build.gradle.template b/platform/android/build.gradle.template
index 13b4d3b6c7..89189ef1a0 100644
--- a/platform/android/build.gradle.template
+++ b/platform/android/build.gradle.template
@@ -20,7 +20,7 @@ allprojects {
}
dependencies {
- compile 'com.android.support:support-v4:23.+' // can be removed if minSdkVersion 16 and modify DownloadNotification.java & V14CustomNotification.java
+ compile 'com.android.support:support-v4:27.+' // can be removed if minSdkVersion 16 and modify DownloadNotification.java & V14CustomNotification.java
$$GRADLE_DEPENDENCIES$$
}
diff --git a/platform/android/java/src/org/godotengine/godot/Godot.java b/platform/android/java/src/org/godotengine/godot/Godot.java
index 37f25cc839..b5b0afb9e0 100644
--- a/platform/android/java/src/org/godotengine/godot/Godot.java
+++ b/platform/android/java/src/org/godotengine/godot/Godot.java
@@ -828,7 +828,6 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
//@Override public boolean dispatchTouchEvent (MotionEvent event) {
public boolean gotTouchEvent(final MotionEvent event) {
- super.onTouchEvent(event);
final int evcount = event.getPointerCount();
if (evcount == 0)
return true;
@@ -842,6 +841,7 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
arr[i * 3 + 1] = (int)event.getX(i);
arr[i * 3 + 2] = (int)event.getY(i);
}
+ final int pointer_idx = event.getPointerId(event.getActionIndex());
//System.out.printf("gaction: %d\n",event.getAction());
final int action = event.getAction() & MotionEvent.ACTION_MASK;
@@ -862,13 +862,10 @@ public class Godot extends Activity implements SensorEventListener, IDownloaderC
*/
} break;
case MotionEvent.ACTION_POINTER_UP: {
- final int indexPointUp = event.getActionIndex();
- final int pointer_idx = event.getPointerId(indexPointUp);
GodotLib.touch(4, pointer_idx, evcount, arr);
//System.out.printf("%d - s.up at: %f,%f\n",pointer_idx, event.getX(pointer_idx),event.getY(pointer_idx));
} break;
case MotionEvent.ACTION_POINTER_DOWN: {
- int pointer_idx = event.getActionIndex();
GodotLib.touch(3, pointer_idx, evcount, arr);
//System.out.printf("%d - s.down at: %f,%f\n",pointer_idx, event.getX(pointer_idx),event.getY(pointer_idx));
} break;
diff --git a/platform/android/java/src/org/godotengine/godot/GodotView.java b/platform/android/java/src/org/godotengine/godot/GodotView.java
index ca4895a2be..0222758c2b 100644
--- a/platform/android/java/src/org/godotengine/godot/GodotView.java
+++ b/platform/android/java/src/org/godotengine/godot/GodotView.java
@@ -110,7 +110,7 @@ public class GodotView extends GLSurfaceView implements InputDeviceListener {
@Override
public boolean onTouchEvent(MotionEvent event) {
-
+ super.onTouchEvent(event);
return activity.gotTouchEvent(event);
};
diff --git a/platform/android/os_android.cpp b/platform/android/os_android.cpp
index 93272a1000..23811f963a 100644
--- a/platform/android/os_android.cpp
+++ b/platform/android/os_android.cpp
@@ -444,25 +444,27 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
}
touch.clear();
}
-
} break;
- case 3: { // add tuchi
-
- ERR_FAIL_INDEX(p_pointer, p_points.size());
+ case 3: { // add touch
- TouchPos tp = p_points[p_pointer];
- touch.push_back(tp);
+ for (int i = 0; i < p_points.size(); i++) {
+ if (p_points[i].id == p_pointer) {
+ TouchPos tp = p_points[i];
+ touch.push_back(tp);
- Ref<InputEventScreenTouch> ev;
- ev.instance();
+ Ref<InputEventScreenTouch> ev;
+ ev.instance();
- ev->set_index(tp.id);
- ev->set_pressed(true);
- ev->set_position(tp.pos);
- input->parse_input_event(ev);
+ ev->set_index(tp.id);
+ ev->set_pressed(true);
+ ev->set_position(tp.pos);
+ input->parse_input_event(ev);
+ break;
+ }
+ }
} break;
- case 4: {
+ case 4: { // remove touch
for (int i = 0; i < touch.size(); i++) {
if (touch[i].id == p_pointer) {
@@ -474,10 +476,10 @@ void OS_Android::process_touch(int p_what, int p_pointer, const Vector<TouchPos>
ev->set_position(touch[i].pos);
input->parse_input_event(ev);
touch.remove(i);
- i--;
+
+ break;
}
}
-
} break;
}
}
diff --git a/platform/iphone/export/export.cpp b/platform/iphone/export/export.cpp
index 99d44f3b5e..e3119814f4 100644
--- a/platform/iphone/export/export.cpp
+++ b/platform/iphone/export/export.cpp
@@ -407,7 +407,7 @@ Error EditorExportPlatformIOS::_export_loading_screens(const Ref<EditorExportPre
Error err = da->copy(loading_screen_file, p_dest_dir + info.export_name);
if (err) {
memdelete(da);
- String err_str = String("Failed to export loading screen: ") + loading_screen_file;
+ String err_str = String("Failed to export loading screen (") + info.preset_key + ") from path: " + loading_screen_file;
ERR_PRINT(err_str.utf8().get_data());
return err;
}
diff --git a/platform/javascript/detect.py b/platform/javascript/detect.py
index 8472c3ccab..8c7a904bca 100644
--- a/platform/javascript/detect.py
+++ b/platform/javascript/detect.py
@@ -49,8 +49,14 @@ def configure(env):
## Build type
if (env["target"] == "release"):
- env.Append(CCFLAGS=['-O3'])
- env.Append(LINKFLAGS=['-O3'])
+ # Use -Os to prioritize optimizing for reduced file size. This is
+ # particularly valuable for the web platform because it directly
+ # decreases download time.
+ # -Os reduces file size by around 5 MiB over -O3. -Oz only saves about
+ # 100 KiB over -Os, which does not justify the negative impact on
+ # run-time performance.
+ env.Append(CCFLAGS=['-Os'])
+ env.Append(LINKFLAGS=['-Os'])
elif (env["target"] == "release_debug"):
env.Append(CCFLAGS=['-O2', '-DDEBUG_ENABLED'])
diff --git a/platform/javascript/engine.js b/platform/javascript/engine.js
index dc4bdc7efb..bca1851f40 100644
--- a/platform/javascript/engine.js
+++ b/platform/javascript/engine.js
@@ -138,13 +138,17 @@
}
var actualCanvas = this.rtenv.canvas;
- var context = false;
+ var testContext = false;
+ var testCanvas;
try {
- context = actualCanvas.getContext('webgl2') || actualCanvas.getContext('experimental-webgl2');
+ testCanvas = document.createElement('canvas');
+ testContext = testCanvas.getContext('webgl2') || testCanvas.getContext('experimental-webgl2');
} catch (e) {}
- if (!context) {
+ if (!testContext) {
throw new Error("WebGL 2 not available");
}
+ testCanvas = null;
+ testContext = null;
// canvas can grab focus on click
if (actualCanvas.tabIndex < 0) {
diff --git a/platform/javascript/javascript_main.cpp b/platform/javascript/javascript_main.cpp
index b738f37d1b..e85fe0800f 100644
--- a/platform/javascript/javascript_main.cpp
+++ b/platform/javascript/javascript_main.cpp
@@ -65,7 +65,7 @@ int main(int argc, char *argv[]) {
FS.mkdir('/userfs');
FS.mount(IDBFS, {}, '/userfs');
FS.syncfs(true, function(err) {
- Module['ccall']('main_after_fs_sync', null, ['string'], [err ? err.message : ""])
+ ccall('main_after_fs_sync', null, ['string'], [err ? err.message : ""])
});
);
/* clang-format on */
diff --git a/platform/javascript/os_javascript.cpp b/platform/javascript/os_javascript.cpp
index c598557738..b10ef821dd 100644
--- a/platform/javascript/os_javascript.cpp
+++ b/platform/javascript/os_javascript.cpp
@@ -566,7 +566,7 @@ void OS_JavaScript::set_css_cursor(const char *p_cursor) {
/* clang-format off */
EM_ASM_({
- Module.canvas.style.cursor = Module.UTF8ToString($0);
+ Module.canvas.style.cursor = UTF8ToString($0);
}, p_cursor);
/* clang-format on */
}
@@ -576,7 +576,7 @@ const char *OS_JavaScript::get_css_cursor() const {
char cursor[16];
/* clang-format off */
EM_ASM_INT({
- Module.stringToUTF8(Module.canvas.style.cursor ? Module.canvas.style.cursor : 'auto', $0, 16);
+ stringToUTF8(Module.canvas.style.cursor ? Module.canvas.style.cursor : 'auto', $0, 16);
}, cursor);
/* clang-format on */
return cursor;
@@ -782,6 +782,9 @@ void OS_JavaScript::set_cursor_shape(CursorShape p_shape) {
set_css_cursor(godot2dom_cursor(cursor_shape));
}
+void OS_JavaScript::set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot) {
+}
+
void OS_JavaScript::main_loop_begin() {
if (main_loop)
@@ -789,7 +792,7 @@ void OS_JavaScript::main_loop_begin() {
/* clang-format off */
EM_ASM_ARGS({
- const send_notification = Module.cwrap('send_notification', null, ['number']);
+ const send_notification = cwrap('send_notification', null, ['number']);
const notifs = arguments;
(['mouseover', 'mouseleave', 'focus', 'blur']).forEach(function(event, i) {
Module.canvas.addEventListener(event, send_notification.bind(null, notifs[i]));
@@ -986,6 +989,7 @@ bool OS_JavaScript::is_userfs_persistent() const {
}
OS_JavaScript::OS_JavaScript(const char *p_execpath, GetUserDataDirFunc p_get_user_data_dir_func) {
+
set_cmdline(p_execpath, get_cmdline_args());
main_loop = NULL;
gl_extensions = NULL;
@@ -998,6 +1002,10 @@ OS_JavaScript::OS_JavaScript(const char *p_execpath, GetUserDataDirFunc p_get_us
idbfs_available = false;
time_to_save_sync = -1;
+
+ Vector<Logger *> loggers;
+ loggers.push_back(memnew(StdLogger));
+ _set_logger(memnew(CompositeLogger(loggers)));
}
OS_JavaScript::~OS_JavaScript() {
diff --git a/platform/javascript/os_javascript.h b/platform/javascript/os_javascript.h
index 2af90ef16b..ce4763ab64 100644
--- a/platform/javascript/os_javascript.h
+++ b/platform/javascript/os_javascript.h
@@ -128,6 +128,7 @@ public:
virtual bool is_userfs_persistent() const;
virtual void set_cursor_shape(CursorShape p_shape);
+ virtual void set_custom_mouse_cursor(const RES &p_cursor, CursorShape p_shape, const Vector2 &p_hotspot);
void main_loop_begin();
bool main_loop_iterate();
diff --git a/platform/osx/detect.py b/platform/osx/detect.py
index 2e686fbee4..bb601abd40 100644
--- a/platform/osx/detect.py
+++ b/platform/osx/detect.py
@@ -76,7 +76,7 @@ def configure(env):
mpprefix = os.environ.get("MACPORTS_PREFIX", "/opt/local")
mpclangver = env["macports_clang"]
env["CC"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang"
- env["LD"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang++"
+ env["LINK"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang++"
env["CXX"] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/clang++"
env['AR'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ar"
env['RANLIB'] = mpprefix + "/libexec/llvm-" + mpclangver + "/bin/llvm-ranlib"
@@ -110,7 +110,7 @@ def configure(env):
if (env["CXX"] == "clang++"):
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
env["CC"] = "clang"
- env["LD"] = "clang++"
+ env["LINK"] = "clang++"
## Dependencies
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 852e9834d4..19f33c814f 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -58,25 +58,31 @@
#include <unistd.h>
#if MAC_OS_X_VERSION_MAX_ALLOWED < 101200
+#define NSEventMaskAny NSAnyEventMask
+#define NSEventTypeKeyDown NSKeyDown
+#define NSEventTypeKeyUp NSKeyUp
+#define NSEventModifierFlagShift NSShiftKeyMask
+#define NSEventModifierFlagCommand NSCommandKeyMask
+#define NSEventModifierFlagControl NSControlKeyMask
+#define NSEventModifierFlagOption NSAlternateKeyMask
+#define NSWindowStyleMaskTitled NSTitledWindowMask
+#define NSWindowStyleMaskResizable NSResizableWindowMask
+#define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask
+#define NSWindowStyleMaskClosable NSClosableWindowMask
#define NSWindowStyleMaskBorderless NSBorderlessWindowMask
#endif
static NSRect convertRectToBacking(NSRect contentRect) {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
- if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
- return [OS_OSX::singleton->window_view convertRectToBacking:contentRect];
- else
-#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
- return contentRect;
+ return [OS_OSX::singleton->window_view convertRectToBacking:contentRect];
}
static void get_key_modifier_state(unsigned int p_osx_state, Ref<InputEventWithModifiers> state) {
- state->set_shift((p_osx_state & NSShiftKeyMask));
- state->set_control((p_osx_state & NSControlKeyMask));
- state->set_alt((p_osx_state & NSAlternateKeyMask));
- state->set_metakey((p_osx_state & NSCommandKeyMask));
+ state->set_shift((p_osx_state & NSEventModifierFlagShift));
+ state->set_control((p_osx_state & NSEventModifierFlagControl));
+ state->set_alt((p_osx_state & NSEventModifierFlagOption));
+ state->set_metakey((p_osx_state & NSEventModifierFlagCommand));
}
static int mouse_x = 0;
@@ -104,7 +110,7 @@ static Vector2 get_mouse_pos(NSEvent *event) {
// special case handling of command-period, which is traditionally a special
// shortcut in macOS and doesn't arrive at our regular keyDown handler.
- if ([event type] == NSKeyDown) {
+ if ([event type] == NSEventTypeKeyDown) {
if (([event modifierFlags] & NSEventModifierFlagCommand) && [event keyCode] == 0x2f) {
Ref<InputEventKey> k;
@@ -122,7 +128,7 @@ static Vector2 get_mouse_pos(NSEvent *event) {
// From http://cocoadev.com/index.pl?GameKeyboardHandlingAlmost
// This works around an AppKit bug, where key up events while holding
// down the command key don't get sent to the key window.
- if ([event type] == NSKeyUp && ([event modifierFlags] & NSCommandKeyMask))
+ if ([event type] == NSEventTypeKeyUp && ([event modifierFlags] & NSEventModifierFlagCommand))
[[self keyWindow] sendEvent:event];
else
[super sendEvent:event];
@@ -188,7 +194,6 @@ static Vector2 get_mouse_pos(NSEvent *event) {
return NO;
}
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
- (void)windowDidEnterFullScreen:(NSNotification *)notification {
OS_OSX::singleton->zoomed = true;
}
@@ -196,7 +201,6 @@ static Vector2 get_mouse_pos(NSEvent *event) {
- (void)windowDidExitFullScreen:(NSNotification *)notification {
OS_OSX::singleton->zoomed = false;
}
-#endif // MAC_OS_X_VERSION_MAX_ALLOWED
- (void)windowDidChangeBackingProperties:(NSNotification *)notification {
if (!OS_OSX::singleton)
@@ -390,8 +394,8 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
- (void)cancelComposition {
[self unmarkText];
- NSInputManager *currentInputManager = [NSInputManager currentInputManager];
- [currentInputManager markedTextAbandoned:self];
+ NSTextInputContext *currentInputContext = [NSTextInputContext currentInputContext];
+ [currentInputContext discardMarkedText];
}
- (void)insertText:(id)aString {
@@ -420,8 +424,8 @@ static const NSRange kEmptyRange = { NSNotFound, 0 };
NSCharacterSet *ctrlChars = [NSCharacterSet controlCharacterSet];
NSCharacterSet *wsnlChars = [NSCharacterSet whitespaceAndNewlineCharacterSet];
if ([characters rangeOfCharacterFromSet:ctrlChars].length && [characters rangeOfCharacterFromSet:wsnlChars].length == 0) {
- NSInputManager *currentInputManager = [NSInputManager currentInputManager];
- [currentInputManager markedTextAbandoned:self];
+ NSTextInputContext *currentInputContext = [NSTextInputContext currentInputContext];
+ [currentInputContext discardMarkedText];
[self cancelComposition];
return;
}
@@ -507,7 +511,7 @@ static void _mouseDownEvent(NSEvent *event, int index, int mask, bool pressed) {
}
- (void)mouseDown:(NSEvent *)event {
- if (([event modifierFlags] & NSControlKeyMask)) {
+ if (([event modifierFlags] & NSEventModifierFlagControl)) {
mouse_down_control = true;
_mouseDownEvent(event, BUTTON_RIGHT, BUTTON_MASK_RIGHT, true);
} else {
@@ -808,29 +812,29 @@ static int translateKey(unsigned int key) {
int mod = [event modifierFlags];
if (key == 0x36 || key == 0x37) {
- if (mod & NSCommandKeyMask) {
- mod &= ~NSCommandKeyMask;
+ if (mod & NSEventModifierFlagCommand) {
+ mod &= ~NSEventModifierFlagCommand;
k->set_pressed(true);
} else {
k->set_pressed(false);
}
} else if (key == 0x38 || key == 0x3c) {
- if (mod & NSShiftKeyMask) {
- mod &= ~NSShiftKeyMask;
+ if (mod & NSEventModifierFlagShift) {
+ mod &= ~NSEventModifierFlagShift;
k->set_pressed(true);
} else {
k->set_pressed(false);
}
} else if (key == 0x3a || key == 0x3d) {
- if (mod & NSAlternateKeyMask) {
- mod &= ~NSAlternateKeyMask;
+ if (mod & NSEventModifierFlagOption) {
+ mod &= ~NSEventModifierFlagOption;
k->set_pressed(true);
} else {
k->set_pressed(false);
}
} else if (key == 0x3b || key == 0x3e) {
- if (mod & NSControlKeyMask) {
- mod &= ~NSControlKeyMask;
+ if (mod & NSEventModifierFlagControl) {
+ mod &= ~NSEventModifierFlagControl;
k->set_pressed(true);
} else {
k->set_pressed(false);
@@ -890,20 +894,12 @@ inline void sendPanEvent(double dx, double dy, int modifierFlags) {
- (void)scrollWheel:(NSEvent *)event {
double deltaX, deltaY;
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
- if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6) {
- deltaX = [event scrollingDeltaX];
- deltaY = [event scrollingDeltaY];
+ deltaX = [event scrollingDeltaX];
+ deltaY = [event scrollingDeltaY];
- if ([event hasPreciseScrollingDeltas]) {
- deltaX *= 0.03;
- deltaY *= 0.03;
- }
- } else
-#endif // MAC_OS_X_VERSION_MAX_ALLOWED
- {
- deltaX = [event deltaX];
- deltaY = [event deltaY];
+ if ([event hasPreciseScrollingDeltas]) {
+ deltaX *= 0.03;
+ deltaY *= 0.03;
}
if ([event phase] != NSEventPhaseNone || [event momentumPhase] != NSEventPhaseNone) {
@@ -1005,7 +1001,7 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
if (p_desired.borderless_window) {
styleMask = NSWindowStyleMaskBorderless;
} else {
- styleMask = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | (p_desired.resizable ? NSResizableWindowMask : 0);
+ styleMask = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | (p_desired.resizable ? NSWindowStyleMaskResizable : 0);
}
window_object = [[GodotWindow alloc]
@@ -1030,7 +1026,7 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
window_size.width = p_desired.width * displayScale;
window_size.height = p_desired.height * displayScale;
- if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6 && displayScale > 1.0) {
+ if (displayScale > 1.0) {
[window_view setWantsBestResolutionOpenGLSurface:YES];
//if (current_videomode.resizable)
[window_object setCollectionBehavior:NSWindowCollectionBehaviorFullScreenPrimary];
@@ -1042,8 +1038,7 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
[window_object setAcceptsMouseMovedEvents:YES];
[window_object center];
- if (floor(NSAppKitVersionNumber) > NSAppKitVersionNumber10_6)
- [window_object setRestorable:NO];
+ [window_object setRestorable:NO];
unsigned int attributeCount = 0;
@@ -1203,34 +1198,42 @@ public:
switch (p_type) {
case ERR_WARNING:
- os_log_info(OS_LOG_DEFAULT,
- "WARNING: %{public}s: %{public}s\nAt: %{public}s:%i.",
- p_function, err_details, p_file, p_line);
+ if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12) {
+ os_log_info(OS_LOG_DEFAULT,
+ "WARNING: %{public}s: %{public}s\nAt: %{public}s:%i.",
+ p_function, err_details, p_file, p_line);
+ }
logf_error("\E[1;33mWARNING: %s: \E[0m\E[1m%s\n", p_function,
err_details);
logf_error("\E[0;33m At: %s:%i.\E[0m\n", p_file, p_line);
break;
case ERR_SCRIPT:
- os_log_error(OS_LOG_DEFAULT,
- "SCRIPT ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.",
- p_function, err_details, p_file, p_line);
+ if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12) {
+ os_log_error(OS_LOG_DEFAULT,
+ "SCRIPT ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.",
+ p_function, err_details, p_file, p_line);
+ }
logf_error("\E[1;35mSCRIPT ERROR: %s: \E[0m\E[1m%s\n", p_function,
err_details);
logf_error("\E[0;35m At: %s:%i.\E[0m\n", p_file, p_line);
break;
case ERR_SHADER:
- os_log_error(OS_LOG_DEFAULT,
- "SHADER ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.",
- p_function, err_details, p_file, p_line);
+ if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12) {
+ os_log_error(OS_LOG_DEFAULT,
+ "SHADER ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.",
+ p_function, err_details, p_file, p_line);
+ }
logf_error("\E[1;36mSHADER ERROR: %s: \E[0m\E[1m%s\n", p_function,
err_details);
logf_error("\E[0;36m At: %s:%i.\E[0m\n", p_file, p_line);
break;
case ERR_ERROR:
default:
- os_log_error(OS_LOG_DEFAULT,
- "ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.",
- p_function, err_details, p_file, p_line);
+ if (floor(NSAppKitVersionNumber) >= NSAppKitVersionNumber10_12) {
+ os_log_error(OS_LOG_DEFAULT,
+ "ERROR: %{public}s: %{public}s\nAt: %{public}s:%i.",
+ p_function, err_details, p_file, p_line);
+ }
logf_error("\E[1;31mERROR: %s: \E[0m\E[1m%s\n", p_function, err_details);
logf_error("\E[0;31m At: %s:%i.\E[0m\n", p_file, p_line);
break;
@@ -1743,9 +1746,8 @@ float OS_OSX::_display_scale(id screen) const {
if ([screen respondsToSelector:@selector(backingScaleFactor)]) {
return fmax(1.0, [screen backingScaleFactor]);
}
- } else {
- return 1.0;
}
+ return 1.0;
}
Point2 OS_OSX::get_native_window_position() const {
@@ -1804,10 +1806,14 @@ void OS_OSX::set_window_size(const Size2 p_size) {
CGFloat menuBarHeight = [[[NSApplication sharedApplication] mainMenu] menuBarHeight];
if (menuBarHeight != 0.f) {
size.y += menuBarHeight;
-#if MAC_OS_X_VERSION_MAX_ALLOWED <= 101104
} else {
- size.y += [[NSStatusBar systemStatusBar] thickness];
+#if MAC_OS_X_VERSION_MAX_ALLOWED >= 101200
+ if (floor(NSAppKitVersionNumber) < NSAppKitVersionNumber10_12) {
+#else
+ {
#endif
+ size.y += [[NSStatusBar systemStatusBar] thickness];
+ }
}
}
@@ -1820,36 +1826,27 @@ void OS_OSX::set_window_size(const Size2 p_size) {
void OS_OSX::set_window_fullscreen(bool p_enabled) {
if (zoomed != p_enabled) {
-#if MAC_OS_X_VERSION_MAX_ALLOWED >= 1070
[window_object toggleFullScreen:nil];
-#else
- [window_object performZoom:nil];
-#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
}
zoomed = p_enabled;
};
bool OS_OSX::is_window_fullscreen() const {
-#if MAC_OS_X_VERSION_MAX_ALLOWED < 1070
- if ([window_object respondsToSelector:@selector(isZoomed)])
- return [window_object isZoomed];
-#endif /*MAC_OS_X_VERSION_MAX_ALLOWED*/
-
return zoomed;
};
void OS_OSX::set_window_resizable(bool p_enabled) {
if (p_enabled)
- [window_object setStyleMask:[window_object styleMask] | NSResizableWindowMask];
+ [window_object setStyleMask:[window_object styleMask] | NSWindowStyleMaskResizable];
else
- [window_object setStyleMask:[window_object styleMask] & ~NSResizableWindowMask];
+ [window_object setStyleMask:[window_object styleMask] & ~NSWindowStyleMaskResizable];
};
bool OS_OSX::is_window_resizable() const {
- return [window_object styleMask] & NSResizableWindowMask;
+ return [window_object styleMask] & NSWindowStyleMaskResizable;
};
void OS_OSX::set_window_minimized(bool p_enabled) {
@@ -1904,7 +1901,7 @@ void OS_OSX::set_borderless_window(bool p_borderless) {
if (p_borderless) {
[window_object setStyleMask:NSWindowStyleMaskBorderless];
} else {
- [window_object setStyleMask:NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask];
+ [window_object setStyleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable];
// Force update of the window styles
NSRect frameRect = [window_object frame];
@@ -2028,7 +2025,7 @@ void OS_OSX::process_events() {
while (true) {
NSEvent *event = [NSApp
- nextEventMatchingMask:NSAnyEventMask
+ nextEventMatchingMask:NSEventMaskAny
untilDate:[NSDate distantPast]
inMode:NSDefaultRunLoopMode
dequeue:YES];
@@ -2220,7 +2217,7 @@ OS_OSX::OS_OSX() {
[apple_menu addItemWithTitle:title action:@selector(hide:) keyEquivalent:@"h"];
menu_item = [apple_menu addItemWithTitle:NSLocalizedString(@"Hide Others", nil) action:@selector(hideOtherApplications:) keyEquivalent:@"h"];
- [menu_item setKeyEquivalentModifierMask:(NSAlternateKeyMask | NSCommandKeyMask)];
+ [menu_item setKeyEquivalentModifierMask:(NSEventModifierFlagOption | NSEventModifierFlagCommand)];
[apple_menu addItemWithTitle:NSLocalizedString(@"Show all", nil) action:@selector(unhideAllApplications:) keyEquivalent:@""];
diff --git a/platform/server/detect.py b/platform/server/detect.py
index ffec2af933..72c9c770e3 100644
--- a/platform/server/detect.py
+++ b/platform/server/detect.py
@@ -59,7 +59,7 @@ def configure(env):
if ('clang++' not in env['CXX']):
env["CC"] = "clang"
env["CXX"] = "clang++"
- env["LD"] = "clang++"
+ env["LINK"] = "clang++"
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
env.extra_suffix = ".llvm" + env.extra_suffix
diff --git a/platform/windows/detect.py b/platform/windows/detect.py
index 489bac50f5..bd05d5605d 100644
--- a/platform/windows/detect.py
+++ b/platform/windows/detect.py
@@ -265,7 +265,7 @@ def configure(env):
env['CXX'] = mingw_prefix + "g++"
env['AR'] = mingw_prefix + "gcc-ar"
env['RANLIB'] = mingw_prefix + "gcc-ranlib"
- env['LD'] = mingw_prefix + "g++"
+ env['LINK'] = mingw_prefix + "g++"
env["x86_libtheora_opt_gcc"] = True
if env['use_lto']:
diff --git a/platform/windows/os_windows.cpp b/platform/windows/os_windows.cpp
index 22294005f6..4f4b225b14 100644
--- a/platform/windows/os_windows.cpp
+++ b/platform/windows/os_windows.cpp
@@ -416,6 +416,7 @@ LRESULT OS_Windows::WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
/*mm->get_button_mask()|=(wParam&MK_XBUTTON1)?(1<<5):0;
mm->get_button_mask()|=(wParam&MK_XBUTTON2)?(1<<6):0;*/
mm->set_position(Vector2(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)));
+ mm->set_global_position(Vector2(GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam)));
if (mouse_mode == MOUSE_MODE_CAPTURED) {
diff --git a/platform/x11/detect.py b/platform/x11/detect.py
index cb45fed1be..478b42f9f7 100644
--- a/platform/x11/detect.py
+++ b/platform/x11/detect.py
@@ -109,7 +109,7 @@ def configure(env):
if ('clang++' not in env['CXX']):
env["CC"] = "clang"
env["CXX"] = "clang++"
- env["LD"] = "clang++"
+ env["LINK"] = "clang++"
env.Append(CPPFLAGS=['-DTYPED_METHOD_BIND'])
env.extra_suffix = ".llvm" + env.extra_suffix