From 8c19ad4b14b680eef1919cd04ac7203182fc050a Mon Sep 17 00:00:00 2001 From: Palana Date: Mon, 16 Dec 2013 16:04:51 +0100 Subject: [PATCH] updated obs platform files --- obs/CMakeLists.txt | 2 +- obs/makefile.am | 2 +- obs/{platform-osx.cpp => platform-osx.mm} | 9 ++++++++- obs/platform.hpp | 3 +++ 4 files changed, 13 insertions(+), 3 deletions(-) rename obs/{platform-osx.cpp => platform-osx.mm} (82%) diff --git a/obs/CMakeLists.txt b/obs/CMakeLists.txt index 94da97815..da3572014 100644 --- a/obs/CMakeLists.txt +++ b/obs/CMakeLists.txt @@ -34,7 +34,7 @@ if(WIN32) platform-windows.cpp) elseif(APPLE) set(obs_platform_src - platform-osx.cpp) + platform-osx.mm) elseif(UNIX) set(obs_platform_src platform-nix.cpp) diff --git a/obs/makefile.am b/obs/makefile.am index ccb7daed5..83fd3a09d 100644 --- a/obs/makefile.am +++ b/obs/makefile.am @@ -26,7 +26,7 @@ obs_SOURCES += platform-windows.cpp endif if OS_OSX -obs_SOURCES += platform-osx.cpp +obs_SOURCES += platform-osx.mm endif if OS_NIX diff --git a/obs/platform-osx.cpp b/obs/platform-osx.mm similarity index 82% rename from obs/platform-osx.cpp rename to obs/platform-osx.mm index 9153b45d7..deb8f5f85 100644 --- a/obs/platform-osx.cpp +++ b/obs/platform-osx.mm @@ -20,6 +20,8 @@ #include +#import + bool GetDataFilePath(const char *data, string &output) { stringstream str; @@ -31,5 +33,10 @@ bool GetDataFilePath(const char *data, string &output) void GetMonitors(vector &monitors) { monitors.clear(); - // TODO + for(NSScreen *screen : [NSScreen screens]) + { + NSRect frame = [screen convertRectToBacking:[screen frame]]; + monitors.emplace_back(frame.origin.x, frame.origin.y, + frame.size.width, frame.size.height); + } } diff --git a/obs/platform.hpp b/obs/platform.hpp index 050c3aeb9..0ccec0b26 100644 --- a/obs/platform.hpp +++ b/obs/platform.hpp @@ -26,6 +26,9 @@ using namespace std; struct MonitorInfo { int32_t x, y; uint32_t cx, cy; + MonitorInfo(int32_t x, int32_t y, uint32_t cx, uint32_t cy) + : x(x), y(y), cx(cx), cy(cy) + {} }; /* Gets the path of obs-studio specific data files (such as locale) */