summaryrefslogtreecommitdiff
path: root/platform/osx
diff options
context:
space:
mode:
Diffstat (limited to 'platform/osx')
-rw-r--r--platform/osx/SCsub2
-rw-r--r--platform/osx/crash_handler_osx.h2
-rw-r--r--platform/osx/crash_handler_osx.mm4
-rw-r--r--platform/osx/os_osx.h5
-rw-r--r--platform/osx/os_osx.mm8
-rw-r--r--platform/osx/power_osx.cpp16
-rw-r--r--platform/osx/power_osx.h13
-rw-r--r--platform/osx/semaphore_osx.cpp (renamed from platform/osx/sem_osx.cpp)5
-rw-r--r--platform/osx/semaphore_osx.h (renamed from platform/osx/sem_osx.h)8
9 files changed, 35 insertions, 28 deletions
diff --git a/platform/osx/SCsub b/platform/osx/SCsub
index dc407eee9e..d2952ebdc0 100644
--- a/platform/osx/SCsub
+++ b/platform/osx/SCsub
@@ -10,7 +10,7 @@ files = [
'crash_handler_osx.mm',
'os_osx.mm',
'godot_main_osx.mm',
- 'sem_osx.cpp',
+ 'semaphore_osx.cpp',
'dir_access_osx.mm',
'joypad_osx.cpp',
'power_osx.cpp',
diff --git a/platform/osx/crash_handler_osx.h b/platform/osx/crash_handler_osx.h
index dead90ca90..6a72ce8ae9 100644
--- a/platform/osx/crash_handler_osx.h
+++ b/platform/osx/crash_handler_osx.h
@@ -45,4 +45,4 @@ public:
~CrashHandler();
};
-#endif
+#endif // CRASH_HANDLER_OSX_H
diff --git a/platform/osx/crash_handler_osx.mm b/platform/osx/crash_handler_osx.mm
index 6684898085..ed8a955ae5 100644
--- a/platform/osx/crash_handler_osx.mm
+++ b/platform/osx/crash_handler_osx.mm
@@ -28,9 +28,11 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
+#include "crash_handler_osx.h"
+
+#include "core/os/os.h"
#include "core/project_settings.h"
#include "main/main.h"
-#include "os_osx.h"
#include <string.h>
#include <unistd.h>
diff --git a/platform/osx/os_osx.h b/platform/osx/os_osx.h
index 927c8c9b00..dfe7b27bd0 100644
--- a/platform/osx/os_osx.h
+++ b/platform/osx/os_osx.h
@@ -34,7 +34,7 @@
#include "core/os/input.h"
#include "crash_handler_osx.h"
#include "drivers/coreaudio/audio_driver_coreaudio.h"
-#include "drivers/coremidi/core_midi.h"
+#include "drivers/coremidi/midi_driver_coremidi.h"
#include "drivers/unix/os_unix.h"
#include "joypad_osx.h"
#include "main/input_default.h"
@@ -43,6 +43,7 @@
#include "servers/visual/rasterizer.h"
#include "servers/visual/visual_server_wrap_mt.h"
#include "servers/visual_server.h"
+
#include <AppKit/AppKit.h>
#include <AppKit/NSCursor.h>
#include <ApplicationServices/ApplicationServices.h>
@@ -132,7 +133,7 @@ public:
String im_text;
Point2 im_selection;
- power_osx *power_manager;
+ PowerOSX *power_manager;
CrashHandler crash_handler;
diff --git a/platform/osx/os_osx.mm b/platform/osx/os_osx.mm
index 3f80d19fa1..225e0aee06 100644
--- a/platform/osx/os_osx.mm
+++ b/platform/osx/os_osx.mm
@@ -37,7 +37,7 @@
#include "drivers/gles2/rasterizer_gles2.h"
#include "drivers/gles3/rasterizer_gles3.h"
#include "main/main.h"
-#include "sem_osx.h"
+#include "semaphore_osx.h"
#include "servers/visual/visual_server_raster.h"
#include <mach-o/dyld.h>
@@ -282,7 +282,9 @@ static CVReturn DisplayLinkCallback(CVDisplayLinkRef displayLink, const CVTimeSt
NSWindow *window = (NSWindow *)[notification object];
CGFloat newBackingScaleFactor = [window backingScaleFactor];
CGFloat oldBackingScaleFactor = [[[notification userInfo] objectForKey:@"NSBackingPropertyOldScaleFactorKey"] doubleValue];
- [OS_OSX::singleton->window_view setWantsBestResolutionOpenGLSurface:YES];
+ if (OS_OSX::singleton->is_hidpi_allowed()) {
+ [OS_OSX::singleton->window_view setWantsBestResolutionOpenGLSurface:YES];
+ }
if (newBackingScaleFactor != oldBackingScaleFactor) {
//Set new display scale and window size
@@ -1459,7 +1461,7 @@ Error OS_OSX::initialize(const VideoMode &p_desired, int p_video_driver, int p_a
input = memnew(InputDefault);
joypad_osx = memnew(JoypadOSX);
- power_manager = memnew(power_osx);
+ power_manager = memnew(PowerOSX);
_ensure_user_data_dir();
diff --git a/platform/osx/power_osx.cpp b/platform/osx/power_osx.cpp
index a7cf9d831f..04d423d8c5 100644
--- a/platform/osx/power_osx.cpp
+++ b/platform/osx/power_osx.cpp
@@ -67,7 +67,7 @@ Adapted from corresponding SDL 2.0 code.
CFDictionaryGetValueIfPresent(dict, CFSTR(k), (const void **)v)
/* Note that AC power sources also include a laptop battery it is charging. */
-void power_osx::checkps(CFDictionaryRef dict, bool *have_ac, bool *have_battery, bool *charging) {
+void PowerOSX::checkps(CFDictionaryRef dict, bool *have_ac, bool *have_battery, bool *charging) {
CFStringRef strval; /* don't CFRelease() this. */
CFBooleanRef bval;
CFNumberRef numval;
@@ -169,7 +169,7 @@ void power_osx::checkps(CFDictionaryRef dict, bool *have_ac, bool *have_battery,
#undef STRMATCH
// CODE CHUNK IMPORTED FROM SDL 2.0
-bool power_osx::GetPowerInfo_MacOSX() {
+bool PowerOSX::GetPowerInfo_MacOSX() {
CFTypeRef blob = IOPSCopyPowerSourcesInfo();
nsecs_left = -1;
@@ -211,14 +211,14 @@ bool power_osx::GetPowerInfo_MacOSX() {
return true; /* always the definitive answer on Mac OS X. */
}
-bool power_osx::UpdatePowerInfo() {
+bool PowerOSX::UpdatePowerInfo() {
if (GetPowerInfo_MacOSX()) {
return true;
}
return false;
}
-OS::PowerState power_osx::get_power_state() {
+OS::PowerState PowerOSX::get_power_state() {
if (UpdatePowerInfo()) {
return power_state;
} else {
@@ -226,7 +226,7 @@ OS::PowerState power_osx::get_power_state() {
}
}
-int power_osx::get_power_seconds_left() {
+int PowerOSX::get_power_seconds_left() {
if (UpdatePowerInfo()) {
return nsecs_left;
} else {
@@ -234,7 +234,7 @@ int power_osx::get_power_seconds_left() {
}
}
-int power_osx::get_power_percent_left() {
+int PowerOSX::get_power_percent_left() {
if (UpdatePowerInfo()) {
return percent_left;
} else {
@@ -242,11 +242,11 @@ int power_osx::get_power_percent_left() {
}
}
-power_osx::power_osx() :
+PowerOSX::PowerOSX() :
nsecs_left(-1),
percent_left(-1),
power_state(OS::POWERSTATE_UNKNOWN) {
}
-power_osx::~power_osx() {
+PowerOSX::~PowerOSX() {
}
diff --git a/platform/osx/power_osx.h b/platform/osx/power_osx.h
index 0f18f9f691..40d0d40fd4 100644
--- a/platform/osx/power_osx.h
+++ b/platform/osx/power_osx.h
@@ -28,15 +28,16 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef PLATFORM_OSX_POWER_OSX_H_
-#define PLATFORM_OSX_POWER_OSX_H_
+#ifndef POWER_OSX_H
+#define POWER_OSX_H
#include "core/os/file_access.h"
#include "core/os/os.h"
#include "dir_access_osx.h"
+
#include <CoreFoundation/CoreFoundation.h>
-class power_osx {
+class PowerOSX {
private:
int nsecs_left;
@@ -47,12 +48,12 @@ private:
bool UpdatePowerInfo();
public:
- power_osx();
- virtual ~power_osx();
+ PowerOSX();
+ virtual ~PowerOSX();
OS::PowerState get_power_state();
int get_power_seconds_left();
int get_power_percent_left();
};
-#endif /* PLATFORM_OSX_POWER_OSX_H_ */
+#endif // POWER_OSX_H
diff --git a/platform/osx/sem_osx.cpp b/platform/osx/semaphore_osx.cpp
index 4c3bad4379..fe7d19bd9e 100644
--- a/platform/osx/sem_osx.cpp
+++ b/platform/osx/semaphore_osx.cpp
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* sem_osx.cpp */
+/* semaphore_osx.cpp */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,7 +28,7 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#include "sem_osx.h"
+#include "semaphore_osx.h"
#include <fcntl.h>
#include <unistd.h>
@@ -66,6 +66,7 @@ void cgsem_destroy(cgsem_t *cgsem) {
}
#include "core/os/memory.h"
+
#include <errno.h>
Error SemaphoreOSX::wait() {
diff --git a/platform/osx/sem_osx.h b/platform/osx/semaphore_osx.h
index 563bdfdcb1..c8e7c45227 100644
--- a/platform/osx/sem_osx.h
+++ b/platform/osx/semaphore_osx.h
@@ -1,5 +1,5 @@
/*************************************************************************/
-/* sem_osx.h */
+/* semaphore_osx.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
@@ -28,8 +28,8 @@
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
-#ifndef SEM_OSX_H
-#define SEM_OSX_H
+#ifndef SEMAPHORE_OSX_H
+#define SEMAPHORE_OSX_H
struct cgsem {
int pipefd[2];
@@ -56,4 +56,4 @@ public:
~SemaphoreOSX();
};
-#endif
+#endif // SEMAPHORE_OSX_H