From cb681aad2d1cb8e1220074da2e1e438a8038012f Mon Sep 17 00:00:00 2001 From: "alexey.lysiuk" Date: Mon, 5 Jan 2015 17:24:54 +0200 Subject: [PATCH] Rearranged header files and #include's Removed unused OS version check Reduced number of headers Fixed build with SDK 10.4 --- src/posix/cocoa/i_common.h | 21 +++++++++++--- src/posix/cocoa/i_input.mm | 9 ++---- src/posix/cocoa/i_main.mm | 32 ++------------------- src/posix/cocoa/i_osversion.h | 43 ----------------------------- src/posix/cocoa/i_rbopts.h | 52 ----------------------------------- src/posix/cocoa/i_video.mm | 12 ++------ 6 files changed, 25 insertions(+), 144 deletions(-) delete mode 100644 src/posix/cocoa/i_osversion.h delete mode 100644 src/posix/cocoa/i_rbopts.h diff --git a/src/posix/cocoa/i_common.h b/src/posix/cocoa/i_common.h index ea51e1c886..3f26e7940e 100644 --- a/src/posix/cocoa/i_common.h +++ b/src/posix/cocoa/i_common.h @@ -31,10 +31,23 @@ ** */ -#import -#import -#import -#import +#import + + +struct RenderBufferOptions +{ + float pixelScale; + + float shiftX; + float shiftY; + + float width; + float height; + + bool dirty; +}; + +extern RenderBufferOptions rbOpts; inline bool I_IsHiDPISupported() diff --git a/src/posix/cocoa/i_input.mm b/src/posix/cocoa/i_input.mm index 46f5e4450d..5e0c5f1c85 100644 --- a/src/posix/cocoa/i_input.mm +++ b/src/posix/cocoa/i_input.mm @@ -2,7 +2,7 @@ ** i_input.mm ** **--------------------------------------------------------------------------- - ** Copyright 2012-2014 Alexey Lysiuk + ** Copyright 2012-2015 Alexey Lysiuk ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without @@ -31,8 +31,8 @@ ** */ -#import -#import +#include "i_common.h" + #import // Avoid collision between DObject class and Objective-C @@ -48,9 +48,6 @@ #include "doomstat.h" #include "v_video.h" -#include "i_common.h" -#include "i_rbopts.h" - #undef Class diff --git a/src/posix/cocoa/i_main.mm b/src/posix/cocoa/i_main.mm index b76ec09841..bb13091095 100644 --- a/src/posix/cocoa/i_main.mm +++ b/src/posix/cocoa/i_main.mm @@ -31,10 +31,9 @@ ** */ -#include +#include "i_common.h" -#import -#import +#include // Avoid collision between DObject class and Objective-C #define Class ObjectClass @@ -49,9 +48,6 @@ #include "s_sound.h" #include "version.h" -#include "i_common.h" -#include "i_osversion.h" - #undef Class @@ -492,27 +488,6 @@ void CreateMenu() [NSApp setMainMenu:menuBar]; } -DarwinVersion GetDarwinVersion() -{ - DarwinVersion result = {}; - - int mib[2] = { CTL_KERN, KERN_OSRELEASE }; - size_t size = 0; - - if (0 == sysctl(mib, 2, NULL, &size, NULL, 0)) - { - char* version = static_cast(alloca(size)); - - if (0 == sysctl(mib, 2, version, &size, NULL, 0)) - { - sscanf(version, "%hu.%hu.%hu", - &result.major, &result.minor, &result.bugfix); - } - } - - return result; -} - void ReleaseApplicationController() { if (NULL != appCtrl) @@ -528,9 +503,6 @@ void ReleaseApplicationController() } // unnamed namespace -const DarwinVersion darwinVersion = GetDarwinVersion(); - - int main(int argc, char** argv) { for (int i = 0; i <= argc; ++i) diff --git a/src/posix/cocoa/i_osversion.h b/src/posix/cocoa/i_osversion.h deleted file mode 100644 index 5e6ac6d205..0000000000 --- a/src/posix/cocoa/i_osversion.h +++ /dev/null @@ -1,43 +0,0 @@ -/* - ** i_osversion.h - ** - **--------------------------------------------------------------------------- - ** Copyright 2012-2014 Alexey Lysiuk - ** All rights reserved. - ** - ** Redistribution and use in source and binary forms, with or without - ** modification, are permitted provided that the following conditions - ** are met: - ** - ** 1. Redistributions of source code must retain the above copyright - ** notice, this list of conditions and the following disclaimer. - ** 2. Redistributions in binary form must reproduce the above copyright - ** notice, this list of conditions and the following disclaimer in the - ** documentation and/or other materials provided with the distribution. - ** 3. The name of the author may not be used to endorse or promote products - ** derived from this software without specific prior written permission. - ** - ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - ** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - ** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - ** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - **--------------------------------------------------------------------------- - ** - */ - -#include - -struct DarwinVersion -{ - uint16_t major; - uint16_t minor; - uint16_t bugfix; -}; - -extern const DarwinVersion darwinVersion; diff --git a/src/posix/cocoa/i_rbopts.h b/src/posix/cocoa/i_rbopts.h deleted file mode 100644 index 40a9ff17ae..0000000000 --- a/src/posix/cocoa/i_rbopts.h +++ /dev/null @@ -1,52 +0,0 @@ -/* - ** i_rbopts.h - ** - **--------------------------------------------------------------------------- - ** Copyright 2014 Alexey Lysiuk - ** All rights reserved. - ** - ** Redistribution and use in source and binary forms, with or without - ** modification, are permitted provided that the following conditions - ** are met: - ** - ** 1. Redistributions of source code must retain the above copyright - ** notice, this list of conditions and the following disclaimer. - ** 2. Redistributions in binary form must reproduce the above copyright - ** notice, this list of conditions and the following disclaimer in the - ** documentation and/or other materials provided with the distribution. - ** 3. The name of the author may not be used to endorse or promote products - ** derived from this software without specific prior written permission. - ** - ** THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR - ** IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - ** OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. - ** IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, - ** INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT - ** NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, - ** DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY - ** THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - ** (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF - ** THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. - **--------------------------------------------------------------------------- - ** - */ - -#ifndef SRC_COCOA_I_RBOPTS_H_INCLUDED -#define SRC_COCOA_I_RBOPTS_H_INCLUDED - -struct RenderBufferOptions -{ - float pixelScale; - - float shiftX; - float shiftY; - - float width; - float height; - - bool dirty; -}; - -extern RenderBufferOptions rbOpts; - -#endif // SRC_COCOA_I_RBOPTS_H_INCLUDED diff --git a/src/posix/cocoa/i_video.mm b/src/posix/cocoa/i_video.mm index cb988002ca..b5f54c2563 100644 --- a/src/posix/cocoa/i_video.mm +++ b/src/posix/cocoa/i_video.mm @@ -2,7 +2,7 @@ ** i_video.mm ** **--------------------------------------------------------------------------- - ** Copyright 2012-2014 Alexey Lysiuk + ** Copyright 2012-2015 Alexey Lysiuk ** All rights reserved. ** ** Redistribution and use in source and binary forms, with or without @@ -31,11 +31,8 @@ ** */ -#import -#import -#import -#import -#import +#include "i_common.h" + #import #import @@ -58,9 +55,6 @@ #include "v_video.h" #include "version.h" -#include "i_common.h" -#include "i_rbopts.h" - #undef Class