mirror of
https://github.com/Shpoike/Quakespasm.git
synced 2025-04-20 09:55:38 +00:00
silence a few macOS deprecation warnings.
The IOHID deprecation (its use is in in_sdl.c for the mouse acceleration hack) still needs addressing: in_sdl.c:163:7: warning: 'IOHIDGetAccelerationWithKey' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations] if (IOHIDGetAccelerationWithKey(mouseDev, CFSTR(kIOHIDMouseAccelerationType), &originalMouseSpeed) == kIOReturnSuccess) ^ /opt/MacOSX11.3.sdk/System/Library/Frameworks/IOKit.framework/Headers/hidsystem/IOHIDLib.h:96:1: note: 'IOHIDGetAccelerationWithKey' has been explicitly marked deprecated here IOHIDGetAccelerationWithKey( io_connect_t handle, CFStringRef key, double * acceleration ) __attribute__((availability(macos,introduced=10.0,deprecated=10.12))); ^ in_sdl.c:165:8: warning: 'IOHIDSetAccelerationWithKey' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations] if (IOHIDSetAccelerationWithKey(mouseDev, CFSTR(kIOHIDMouseAccelerationType), -1.0) != kIOReturnSuccess) ^ /opt/MacOSX11.3.sdk/System/Library/Frameworks/IOKit.framework/Headers/hidsystem/IOHIDLib.h:99:1: note: 'IOHIDSetAccelerationWithKey' has been explicitly marked deprecated here IOHIDSetAccelerationWithKey( io_connect_t handle, CFStringRef key, double acceleration ) __attribute__((availability(macos,introduced=10.0,deprecated=10.12))); ^ in_sdl.c:190:7: warning: 'IOHIDSetAccelerationWithKey' is deprecated: first deprecated in macOS 10.12 [-Wdeprecated-declarations] if (IOHIDSetAccelerationWithKey(mouseDev, CFSTR(kIOHIDMouseAccelerationType), originalMouseSpeed) != kIOReturnSuccess) ^ /opt/MacOSX11.3.sdk/System/Library/Frameworks/IOKit.framework/Headers/hidsystem/IOHIDLib.h:99:1: note: 'IOHIDSetAccelerationWithKey' has been explicitly marked deprecated here IOHIDSetAccelerationWithKey( io_connect_t handle, CFStringRef key, double acceleration ) __attribute__((availability(macos,introduced=10.0,deprecated=10.12))); ^
This commit is contained in:
parent
848aa26b3c
commit
78323635a0
2 changed files with 24 additions and 6 deletions
|
@ -110,17 +110,21 @@ NSString *FQPrefScreenModeKey = @"ScreenMode";
|
|||
return screenModes;
|
||||
}
|
||||
|
||||
#ifndef MAC_OS_X_VERSION_10_13
|
||||
#define NSControlStateValueOff NSOffState
|
||||
#define NSControlStateValueOn NSOnState
|
||||
#endif
|
||||
- (void)awakeFromNib {
|
||||
if ([arguments count] > 0) {
|
||||
[paramTextField setStringValue:[arguments description]];
|
||||
if ([arguments argument:@"-window"] != nil)
|
||||
[fullscreenCheckBox setState:NSOffState];
|
||||
[fullscreenCheckBox setState:NSControlStateValueOff];
|
||||
} else {
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
[paramTextField setStringValue:[defaults stringForKey:FQPrefCommandLineKey]];
|
||||
|
||||
BOOL fullscreen = [defaults boolForKey:FQPrefFullscreenKey];
|
||||
[fullscreenCheckBox setState:fullscreen ? NSOnState : NSOffState];
|
||||
[fullscreenCheckBox setState:fullscreen ? NSControlStateValueOn : NSControlStateValueOff];
|
||||
|
||||
int screenModeIndex = [defaults integerForKey:FQPrefScreenModeKey];
|
||||
[screenModePopUp selectItemAtIndex:screenModeIndex];
|
||||
|
@ -160,7 +164,7 @@ NSString *FQPrefScreenModeKey = @"ScreenMode";
|
|||
|
||||
[arguments removeArgument:@"-fullscreen"];
|
||||
[arguments removeArgument:@"-window"];
|
||||
BOOL fullscreen = [fullscreenCheckBox state] == NSOnState;
|
||||
BOOL fullscreen = [fullscreenCheckBox state] == NSControlStateValueOn;
|
||||
if (fullscreen)
|
||||
[arguments addArgument:@"-fullscreen"];
|
||||
else
|
||||
|
@ -186,7 +190,7 @@ NSString *FQPrefScreenModeKey = @"ScreenMode";
|
|||
// update the defaults
|
||||
NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
|
||||
[defaults setObject:[paramTextField stringValue] forKey:FQPrefCommandLineKey];
|
||||
[defaults setObject:[NSNumber numberWithBool:[fullscreenCheckBox state] == NSOnState] forKey:FQPrefFullscreenKey];
|
||||
[defaults setObject:[NSNumber numberWithBool:[fullscreenCheckBox state] == NSControlStateValueOn] forKey:FQPrefFullscreenKey];
|
||||
[defaults setObject:[NSNumber numberWithInt:index] forKey:FQPrefScreenModeKey];
|
||||
[defaults synchronize];
|
||||
|
||||
|
|
|
@ -42,6 +42,9 @@ void PL_VID_Shutdown (void)
|
|||
{
|
||||
}
|
||||
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1060
|
||||
#define NSPasteboardTypeString NSStringPboardType
|
||||
#endif
|
||||
#define MAX_CLIPBOARDTXT MAXCMDLINE /* 256 */
|
||||
char *PL_GetClipboardData (void)
|
||||
{
|
||||
|
@ -49,8 +52,8 @@ char *PL_GetClipboardData (void)
|
|||
NSPasteboard* pasteboard = [NSPasteboard generalPasteboard];
|
||||
NSArray* types = [pasteboard types];
|
||||
|
||||
if ([types containsObject: NSStringPboardType]) {
|
||||
NSString* clipboardString = [pasteboard stringForType: NSStringPboardType];
|
||||
if ([types containsObject: NSPasteboardTypeString]) {
|
||||
NSString* clipboardString = [pasteboard stringForType: NSPasteboardTypeString];
|
||||
if (clipboardString != NULL && [clipboardString length] > 0) {
|
||||
size_t sz = [clipboardString length] + 1;
|
||||
sz = q_min(MAX_CLIPBOARDTXT, sz);
|
||||
|
@ -65,6 +68,9 @@ char *PL_GetClipboardData (void)
|
|||
return data;
|
||||
}
|
||||
|
||||
#ifndef MAC_OS_X_VERSION_10_12
|
||||
#define NSAlertStyleCritical NSCriticalAlertStyle
|
||||
#endif
|
||||
void PL_ErrorDialog(const char *errorMsg)
|
||||
{
|
||||
#if (MAC_OS_X_VERSION_MIN_REQUIRED < 1040) /* ppc builds targeting 10.3 and older */
|
||||
|
@ -72,6 +78,14 @@ void PL_ErrorDialog(const char *errorMsg)
|
|||
#else
|
||||
NSString* msg = [NSString stringWithCString:errorMsg encoding:NSASCIIStringEncoding];
|
||||
#endif
|
||||
#if MAC_OS_X_VERSION_MIN_REQUIRED < 1030
|
||||
NSRunCriticalAlertPanel (@"Quake Error", @"%@", @"OK", nil, nil, msg);
|
||||
#else
|
||||
NSAlert *alert = [[[NSAlert alloc] init] autorelease];
|
||||
alert.alertStyle = NSAlertStyleCritical;
|
||||
alert.messageText = @"Quake Error";
|
||||
alert.informativeText = msg;
|
||||
[alert runModal];
|
||||
#endif
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue