mirror of
https://github.com/ZDoom/qzdoom-gpl.git
synced 2024-11-16 09:11:17 +00:00
Fixed all compilation issues with 10.4 SDK except for HID Utilities
This commit is contained in:
parent
d2d6d2a7f8
commit
d061adfbd6
3 changed files with 103 additions and 9 deletions
|
@ -45,6 +45,80 @@
|
|||
#include <OpenGL/gl.h>
|
||||
#include <OpenGL/glext.h>
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
|
||||
|
||||
// Missing definitions for 10.4 and earlier
|
||||
|
||||
typedef unsigned int NSUInteger;
|
||||
typedef int NSInteger;
|
||||
|
||||
typedef float CGFloat;
|
||||
|
||||
// From HIToolbox/Events.h
|
||||
enum
|
||||
{
|
||||
kVK_Return = 0x24,
|
||||
kVK_Tab = 0x30,
|
||||
kVK_Space = 0x31,
|
||||
kVK_Delete = 0x33,
|
||||
kVK_Escape = 0x35,
|
||||
kVK_Command = 0x37,
|
||||
kVK_Shift = 0x38,
|
||||
kVK_CapsLock = 0x39,
|
||||
kVK_Option = 0x3A,
|
||||
kVK_Control = 0x3B,
|
||||
kVK_RightShift = 0x3C,
|
||||
kVK_RightOption = 0x3D,
|
||||
kVK_RightControl = 0x3E,
|
||||
kVK_Function = 0x3F,
|
||||
kVK_F17 = 0x40,
|
||||
kVK_VolumeUp = 0x48,
|
||||
kVK_VolumeDown = 0x49,
|
||||
kVK_Mute = 0x4A,
|
||||
kVK_F18 = 0x4F,
|
||||
kVK_F19 = 0x50,
|
||||
kVK_F20 = 0x5A,
|
||||
kVK_F5 = 0x60,
|
||||
kVK_F6 = 0x61,
|
||||
kVK_F7 = 0x62,
|
||||
kVK_F3 = 0x63,
|
||||
kVK_F8 = 0x64,
|
||||
kVK_F9 = 0x65,
|
||||
kVK_F11 = 0x67,
|
||||
kVK_F13 = 0x69,
|
||||
kVK_F16 = 0x6A,
|
||||
kVK_F14 = 0x6B,
|
||||
kVK_F10 = 0x6D,
|
||||
kVK_F12 = 0x6F,
|
||||
kVK_F15 = 0x71,
|
||||
kVK_Help = 0x72,
|
||||
kVK_Home = 0x73,
|
||||
kVK_PageUp = 0x74,
|
||||
kVK_ForwardDelete = 0x75,
|
||||
kVK_F4 = 0x76,
|
||||
kVK_End = 0x77,
|
||||
kVK_F2 = 0x78,
|
||||
kVK_PageDown = 0x79,
|
||||
kVK_F1 = 0x7A,
|
||||
kVK_LeftArrow = 0x7B,
|
||||
kVK_RightArrow = 0x7C,
|
||||
kVK_DownArrow = 0x7D,
|
||||
kVK_UpArrow = 0x7E
|
||||
};
|
||||
|
||||
@interface NSView(SupportOutdatedOSX)
|
||||
- (NSPoint)convertPointFromBase:(NSPoint)aPoint;
|
||||
@end
|
||||
|
||||
@implementation NSView(SupportOutdatedOSX)
|
||||
- (NSPoint)convertPointFromBase:(NSPoint)aPoint
|
||||
{
|
||||
return [self convertPoint:aPoint fromView:nil];
|
||||
}
|
||||
@end
|
||||
|
||||
#endif // prior to 10.5
|
||||
|
||||
#include <SDL.h>
|
||||
|
||||
// Avoid collision between DObject class and Objective-C
|
||||
|
@ -272,7 +346,7 @@ void I_ProcessJoysticks();
|
|||
|
||||
void I_GetEvent()
|
||||
{
|
||||
[[NSRunLoop mainRunLoop] limitDateForMode:NSDefaultRunLoopMode];
|
||||
[[NSRunLoop currentRunLoop] limitDateForMode:NSDefaultRunLoopMode];
|
||||
}
|
||||
|
||||
void I_StartTic()
|
||||
|
@ -634,6 +708,7 @@ void ProcessMouseButtonEvent(NSEvent* theEvent)
|
|||
case NSLeftMouseUp: event.subtype = EV_GUI_LButtonUp; break;
|
||||
case NSRightMouseUp: event.subtype = EV_GUI_RButtonUp; break;
|
||||
case NSOtherMouseUp: event.subtype = EV_GUI_MButtonUp; break;
|
||||
default: break;
|
||||
}
|
||||
|
||||
NSEventToGameMousePosition(theEvent, &event);
|
||||
|
@ -655,6 +730,9 @@ void ProcessMouseButtonEvent(NSEvent* theEvent)
|
|||
case NSOtherMouseUp:
|
||||
event.type = EV_KeyUp;
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
event.data1 = std::min(KEY_MOUSE1 + [theEvent buttonNumber], NSInteger(KEY_MOUSE8));
|
||||
|
@ -1011,8 +1089,8 @@ static ApplicationController* appCtrl;
|
|||
selector:@selector(processEvents:)
|
||||
userInfo:nil
|
||||
repeats:YES];
|
||||
[[NSRunLoop mainRunLoop] addTimer:timer
|
||||
forMode:NSDefaultRunLoopMode];
|
||||
[[NSRunLoop currentRunLoop] addTimer:timer
|
||||
forMode:NSDefaultRunLoopMode];
|
||||
|
||||
exit(SDL_main(s_argc, s_argv));
|
||||
}
|
||||
|
@ -1106,22 +1184,22 @@ static ApplicationController* appCtrl;
|
|||
|
||||
attributes[i++] = NSOpenGLPFADoubleBuffer;
|
||||
attributes[i++] = NSOpenGLPFAColorSize;
|
||||
attributes[i++] = 32;
|
||||
attributes[i++] = NSOpenGLPixelFormatAttribute(32);
|
||||
attributes[i++] = NSOpenGLPFADepthSize;
|
||||
attributes[i++] = 24;
|
||||
attributes[i++] = NSOpenGLPixelFormatAttribute(24);
|
||||
attributes[i++] = NSOpenGLPFAStencilSize;
|
||||
attributes[i++] = 8;
|
||||
attributes[i++] = NSOpenGLPixelFormatAttribute(8);
|
||||
|
||||
if (m_multisample)
|
||||
{
|
||||
attributes[i++] = NSOpenGLPFAMultisample;
|
||||
attributes[i++] = NSOpenGLPFASampleBuffers;
|
||||
attributes[i++] = 1;
|
||||
attributes[i++] = NSOpenGLPixelFormatAttribute(1);
|
||||
attributes[i++] = NSOpenGLPFASamples;
|
||||
attributes[i++] = m_multisample;
|
||||
attributes[i++] = NSOpenGLPixelFormatAttribute(m_multisample);
|
||||
}
|
||||
|
||||
attributes[i] = 0;
|
||||
attributes[i] = NSOpenGLPixelFormatAttribute(0);
|
||||
|
||||
NSOpenGLPixelFormat *pixelFormat = [[NSOpenGLPixelFormat alloc] initWithAttributes:attributes];
|
||||
|
||||
|
@ -1344,6 +1422,9 @@ static ApplicationController* appCtrl;
|
|||
case NSFlagsChanged:
|
||||
ProcessKeyboardFlagsEvent(event);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
[NSApp sendEvent:event];
|
||||
|
|
|
@ -48,6 +48,12 @@
|
|||
|
||||
#include <Cocoa/Cocoa.h>
|
||||
#include <wordexp.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
|
||||
// Missing type definition for 10.4 and earlier
|
||||
typedef unsigned int NSUInteger;
|
||||
#endif // prior to 10.5
|
||||
|
||||
CVAR(String, osx_additional_parameters, "", CVAR_ARCHIVE | CVAR_NOSET | CVAR_GLOBALCONFIG);
|
||||
|
||||
|
|
|
@ -550,6 +550,13 @@ void SDLFB::SetVSync (bool vsync)
|
|||
{
|
||||
// Apply vsync for native backend only (where OpenGL context is set)
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1050
|
||||
// Inconsistency between 10.4 and 10.5 SDKs:
|
||||
// third argument of CGLSetParameter() is const long* on 10.4 and const GLint* on 10.5
|
||||
// So, GLint typedef'ed to long instead of int to workaround this issue
|
||||
typedef long GLint;
|
||||
#endif // prior to 10.5
|
||||
|
||||
const GLint value = vsync ? 1 : 0;
|
||||
CGLSetParameter(context, kCGLCPSwapInterval, &value);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue