mirror of
https://github.com/ZDoom/gzdoom.git
synced 2024-11-26 22:11:43 +00:00
- fixed deprecation warnings in Cocoa backend
This commit is contained in:
parent
7741a934b8
commit
8ec6c21195
5 changed files with 55 additions and 55 deletions
|
@ -284,11 +284,11 @@ uint8_t ModifierToDIK(const uint32_t modifier)
|
||||||
{
|
{
|
||||||
switch (modifier)
|
switch (modifier)
|
||||||
{
|
{
|
||||||
case NSAlphaShiftKeyMask: return DIK_CAPITAL;
|
case NSEventModifierFlagCapsLock: return DIK_CAPITAL;
|
||||||
case NSShiftKeyMask: return DIK_LSHIFT;
|
case NSEventModifierFlagShift: return DIK_LSHIFT;
|
||||||
case NSControlKeyMask: return DIK_LCONTROL;
|
case NSEventModifierFlagControl: return DIK_LCONTROL;
|
||||||
case NSAlternateKeyMask: return DIK_LMENU;
|
case NSEventModifierFlagOption: return DIK_LMENU;
|
||||||
case NSCommandKeyMask: return DIK_LWIN;
|
case NSEventModifierFlagCommand: return DIK_LWIN;
|
||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -296,20 +296,20 @@ uint8_t ModifierToDIK(const uint32_t modifier)
|
||||||
|
|
||||||
int16_t ModifierFlagsToGUIKeyModifiers(NSEvent* theEvent)
|
int16_t ModifierFlagsToGUIKeyModifiers(NSEvent* theEvent)
|
||||||
{
|
{
|
||||||
const NSUInteger modifiers([theEvent modifierFlags] & NSDeviceIndependentModifierFlagsMask);
|
const NSUInteger modifiers([theEvent modifierFlags] & NSEventModifierFlagDeviceIndependentFlagsMask);
|
||||||
return ((modifiers & NSShiftKeyMask ) ? GKM_SHIFT : 0)
|
return ((modifiers & NSEventModifierFlagShift ) ? GKM_SHIFT : 0)
|
||||||
| ((modifiers & NSControlKeyMask ) ? GKM_CTRL : 0)
|
| ((modifiers & NSEventModifierFlagControl) ? GKM_CTRL : 0)
|
||||||
| ((modifiers & NSAlternateKeyMask) ? GKM_ALT : 0)
|
| ((modifiers & NSEventModifierFlagOption ) ? GKM_ALT : 0)
|
||||||
| ((modifiers & NSCommandKeyMask ) ? GKM_META : 0);
|
| ((modifiers & NSEventModifierFlagCommand) ? GKM_META : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ShouldGenerateGUICharEvent(NSEvent* theEvent)
|
bool ShouldGenerateGUICharEvent(NSEvent* theEvent)
|
||||||
{
|
{
|
||||||
const NSUInteger modifiers([theEvent modifierFlags] & NSDeviceIndependentModifierFlagsMask);
|
const NSUInteger modifiers([theEvent modifierFlags] & NSEventModifierFlagDeviceIndependentFlagsMask);
|
||||||
return !(modifiers & NSControlKeyMask)
|
return !(modifiers & NSEventModifierFlagControl)
|
||||||
&& !(modifiers & NSAlternateKeyMask)
|
&& !(modifiers & NSEventModifierFlagOption)
|
||||||
&& !(modifiers & NSCommandKeyMask)
|
&& !(modifiers & NSEventModifierFlagCommand)
|
||||||
&& !(modifiers & NSFunctionKeyMask);
|
&& !(modifiers & NSEventModifierFlagFunction);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -373,7 +373,7 @@ void ProcessKeyboardEventInMenu(NSEvent* theEvent)
|
||||||
|
|
||||||
unichar realchar;
|
unichar realchar;
|
||||||
event.type = EV_GUI_Event;
|
event.type = EV_GUI_Event;
|
||||||
event.subtype = NSKeyDown == [theEvent type] ? EV_GUI_KeyDown : EV_GUI_KeyUp;
|
event.subtype = NSEventTypeKeyDown == [theEvent type] ? EV_GUI_KeyDown : EV_GUI_KeyUp;
|
||||||
event.data2 = GetCharacterFromNSEvent(theEvent, &realchar);
|
event.data2 = GetCharacterFromNSEvent(theEvent, &realchar);
|
||||||
event.data3 = ModifierFlagsToGUIKeyModifiers(theEvent);
|
event.data3 = ModifierFlagsToGUIKeyModifiers(theEvent);
|
||||||
|
|
||||||
|
@ -505,8 +505,8 @@ void ProcessKeyboardEvent(NSEvent* theEvent)
|
||||||
|
|
||||||
if (k_allowfullscreentoggle
|
if (k_allowfullscreentoggle
|
||||||
&& (kVK_ANSI_F == keyCode)
|
&& (kVK_ANSI_F == keyCode)
|
||||||
&& (NSCommandKeyMask & [theEvent modifierFlags])
|
&& (NSEventModifierFlagCommand & [theEvent modifierFlags])
|
||||||
&& (NSKeyDown == [theEvent type])
|
&& (NSEventTypeKeyDown == [theEvent type])
|
||||||
&& !isARepeat)
|
&& !isARepeat)
|
||||||
{
|
{
|
||||||
ToggleFullscreen = !ToggleFullscreen;
|
ToggleFullscreen = !ToggleFullscreen;
|
||||||
|
@ -521,7 +521,7 @@ void ProcessKeyboardEvent(NSEvent* theEvent)
|
||||||
{
|
{
|
||||||
event_t event = {};
|
event_t event = {};
|
||||||
|
|
||||||
event.type = NSKeyDown == [theEvent type] ? EV_KeyDown : EV_KeyUp;
|
event.type = NSEventTypeKeyDown == [theEvent type] ? EV_KeyDown : EV_KeyUp;
|
||||||
event.data1 = KEYCODE_TO_DIK[ keyCode ];
|
event.data1 = KEYCODE_TO_DIK[ keyCode ];
|
||||||
|
|
||||||
if (0 != event.data1)
|
if (0 != event.data1)
|
||||||
|
@ -542,7 +542,7 @@ void ProcessKeyboardFlagsEvent(NSEvent* theEvent)
|
||||||
}
|
}
|
||||||
|
|
||||||
static const uint32_t FLAGS_MASK =
|
static const uint32_t FLAGS_MASK =
|
||||||
NSDeviceIndependentModifierFlagsMask & ~NSNumericPadKeyMask;
|
NSEventModifierFlagDeviceIndependentFlagsMask & ~NSEventModifierFlagNumericPad;
|
||||||
|
|
||||||
const uint32_t modifiers = [theEvent modifierFlags] & FLAGS_MASK;
|
const uint32_t modifiers = [theEvent modifierFlags] & FLAGS_MASK;
|
||||||
static uint32_t oldModifiers = 0;
|
static uint32_t oldModifiers = 0;
|
||||||
|
@ -611,12 +611,12 @@ void ProcessMouseButtonEvent(NSEvent* theEvent)
|
||||||
|
|
||||||
switch (cocoaEventType)
|
switch (cocoaEventType)
|
||||||
{
|
{
|
||||||
case NSLeftMouseDown: event.subtype = EV_GUI_LButtonDown; break;
|
case NSEventTypeLeftMouseDown: event.subtype = EV_GUI_LButtonDown; break;
|
||||||
case NSRightMouseDown: event.subtype = EV_GUI_RButtonDown; break;
|
case NSEventTypeRightMouseDown: event.subtype = EV_GUI_RButtonDown; break;
|
||||||
case NSOtherMouseDown: event.subtype = EV_GUI_MButtonDown; break;
|
case NSEventTypeOtherMouseDown: event.subtype = EV_GUI_MButtonDown; break;
|
||||||
case NSLeftMouseUp: event.subtype = EV_GUI_LButtonUp; break;
|
case NSEventTypeLeftMouseUp: event.subtype = EV_GUI_LButtonUp; break;
|
||||||
case NSRightMouseUp: event.subtype = EV_GUI_RButtonUp; break;
|
case NSEventTypeRightMouseUp: event.subtype = EV_GUI_RButtonUp; break;
|
||||||
case NSOtherMouseUp: event.subtype = EV_GUI_MButtonUp; break;
|
case NSEventTypeOtherMouseUp: event.subtype = EV_GUI_MButtonUp; break;
|
||||||
default: break;
|
default: break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -628,15 +628,15 @@ void ProcessMouseButtonEvent(NSEvent* theEvent)
|
||||||
{
|
{
|
||||||
switch (cocoaEventType)
|
switch (cocoaEventType)
|
||||||
{
|
{
|
||||||
case NSLeftMouseDown:
|
case NSEventTypeLeftMouseDown:
|
||||||
case NSRightMouseDown:
|
case NSEventTypeRightMouseDown:
|
||||||
case NSOtherMouseDown:
|
case NSEventTypeOtherMouseDown:
|
||||||
event.type = EV_KeyDown;
|
event.type = EV_KeyDown;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSLeftMouseUp:
|
case NSEventTypeLeftMouseUp:
|
||||||
case NSRightMouseUp:
|
case NSEventTypeRightMouseUp:
|
||||||
case NSOtherMouseUp:
|
case NSEventTypeOtherMouseUp:
|
||||||
event.type = EV_KeyUp;
|
event.type = EV_KeyUp;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
@ -694,36 +694,36 @@ void I_ProcessEvent(NSEvent* event)
|
||||||
|
|
||||||
switch (eventType)
|
switch (eventType)
|
||||||
{
|
{
|
||||||
case NSMouseMoved:
|
case NSEventTypeMouseMoved:
|
||||||
ProcessMouseMoveEvent(event);
|
ProcessMouseMoveEvent(event);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSLeftMouseDown:
|
case NSEventTypeLeftMouseDown:
|
||||||
case NSLeftMouseUp:
|
case NSEventTypeLeftMouseUp:
|
||||||
case NSRightMouseDown:
|
case NSEventTypeRightMouseDown:
|
||||||
case NSRightMouseUp:
|
case NSEventTypeRightMouseUp:
|
||||||
case NSOtherMouseDown:
|
case NSEventTypeOtherMouseDown:
|
||||||
case NSOtherMouseUp:
|
case NSEventTypeOtherMouseUp:
|
||||||
ProcessMouseButtonEvent(event);
|
ProcessMouseButtonEvent(event);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSLeftMouseDragged:
|
case NSEventTypeLeftMouseDragged:
|
||||||
case NSRightMouseDragged:
|
case NSEventTypeRightMouseDragged:
|
||||||
case NSOtherMouseDragged:
|
case NSEventTypeOtherMouseDragged:
|
||||||
ProcessMouseButtonEvent(event);
|
ProcessMouseButtonEvent(event);
|
||||||
ProcessMouseMoveEvent(event);
|
ProcessMouseMoveEvent(event);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSScrollWheel:
|
case NSEventTypeScrollWheel:
|
||||||
ProcessMouseWheelEvent(event);
|
ProcessMouseWheelEvent(event);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSKeyDown:
|
case NSEventTypeKeyDown:
|
||||||
case NSKeyUp:
|
case NSEventTypeKeyUp:
|
||||||
ProcessKeyboardEvent(event);
|
ProcessKeyboardEvent(event);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case NSFlagsChanged:
|
case NSEventTypeFlagsChanged:
|
||||||
ProcessKeyboardFlagsEvent(event);
|
ProcessKeyboardFlagsEvent(event);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
|
|
@ -396,7 +396,7 @@ extern bool AppActive;
|
||||||
|
|
||||||
while (true)
|
while (true)
|
||||||
{
|
{
|
||||||
NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask
|
NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny
|
||||||
untilDate:[NSDate dateWithTimeIntervalSinceNow:0]
|
untilDate:[NSDate dateWithTimeIntervalSinceNow:0]
|
||||||
inMode:NSDefaultRunLoopMode
|
inMode:NSDefaultRunLoopMode
|
||||||
dequeue:YES];
|
dequeue:YES];
|
||||||
|
@ -449,7 +449,7 @@ NSMenuItem* CreateApplicationMenu()
|
||||||
[[menu addItemWithTitle:@"Hide Others"
|
[[menu addItemWithTitle:@"Hide Others"
|
||||||
action:@selector(hideOtherApplications:)
|
action:@selector(hideOtherApplications:)
|
||||||
keyEquivalent:@"h"]
|
keyEquivalent:@"h"]
|
||||||
setKeyEquivalentModifierMask:NSAlternateKeyMask | NSCommandKeyMask];
|
setKeyEquivalentModifierMask:NSEventModifierFlagOption | NSEventModifierFlagCommand];
|
||||||
[menu addItemWithTitle:@"Show All"
|
[menu addItemWithTitle:@"Show All"
|
||||||
action:@selector(unhideAllApplications:)
|
action:@selector(unhideAllApplications:)
|
||||||
keyEquivalent:@""];
|
keyEquivalent:@""];
|
||||||
|
|
|
@ -121,8 +121,8 @@ namespace
|
||||||
const NSInteger LEVEL_FULLSCREEN = NSMainMenuWindowLevel + 1;
|
const NSInteger LEVEL_FULLSCREEN = NSMainMenuWindowLevel + 1;
|
||||||
const NSInteger LEVEL_WINDOWED = NSNormalWindowLevel;
|
const NSInteger LEVEL_WINDOWED = NSNormalWindowLevel;
|
||||||
|
|
||||||
const NSUInteger STYLE_MASK_FULLSCREEN = NSBorderlessWindowMask;
|
const NSUInteger STYLE_MASK_FULLSCREEN = NSWindowStyleMaskBorderless;
|
||||||
const NSUInteger STYLE_MASK_WINDOWED = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask;
|
const NSUInteger STYLE_MASK_WINDOWED = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -104,7 +104,7 @@ FConsoleWindow::FConsoleWindow()
|
||||||
NSString* const title = [NSString stringWithFormat:@"%s %s - Console", GAMENAME, GetVersionString()];
|
NSString* const title = [NSString stringWithFormat:@"%s %s - Console", GAMENAME, GetVersionString()];
|
||||||
|
|
||||||
[m_window initWithContentRect:initialRect
|
[m_window initWithContentRect:initialRect
|
||||||
styleMask:NSTitledWindowMask | NSClosableWindowMask | NSResizableWindowMask
|
styleMask:NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskResizable
|
||||||
backing:NSBackingStoreBuffered
|
backing:NSBackingStoreBuffered
|
||||||
defer:NO];
|
defer:NO];
|
||||||
[m_window setMinSize:[m_window frame].size];
|
[m_window setMinSize:[m_window frame].size];
|
||||||
|
@ -348,7 +348,7 @@ void FConsoleWindow::SetTitleText()
|
||||||
NSTextField* titleText = [[NSTextField alloc] initWithFrame:titleTextRect];
|
NSTextField* titleText = [[NSTextField alloc] initWithFrame:titleTextRect];
|
||||||
[titleText setStringValue:[NSString stringWithCString:GameStartupInfo.Name.GetChars()
|
[titleText setStringValue:[NSString stringWithCString:GameStartupInfo.Name.GetChars()
|
||||||
encoding:NSISOLatin1StringEncoding]];
|
encoding:NSISOLatin1StringEncoding]];
|
||||||
[titleText setAlignment:NSCenterTextAlignment];
|
[titleText setAlignment:NSTextAlignmentCenter];
|
||||||
[titleText setTextColor:RGB(GameStartupInfo.FgColor)];
|
[titleText setTextColor:RGB(GameStartupInfo.FgColor)];
|
||||||
[titleText setBackgroundColor:RGB(GameStartupInfo.BkColor)];
|
[titleText setBackgroundColor:RGB(GameStartupInfo.BkColor)];
|
||||||
[titleText setFont:[NSFont fontWithName:@"Trebuchet MS Bold" size:18.0f]];
|
[titleText setFont:[NSFont fontWithName:@"Trebuchet MS Bold" size:18.0f]];
|
||||||
|
@ -434,7 +434,7 @@ void FConsoleWindow::NetInit(const char* const message, const int playerCount)
|
||||||
// Text with connected/total players count
|
// Text with connected/total players count
|
||||||
m_netCountText = [[NSTextField alloc] initWithFrame:NSMakeRect(428.0f, 64.0f, 72.0f, 16.0f)];
|
m_netCountText = [[NSTextField alloc] initWithFrame:NSMakeRect(428.0f, 64.0f, 72.0f, 16.0f)];
|
||||||
[m_netCountText setAutoresizingMask:NSViewMinXMargin];
|
[m_netCountText setAutoresizingMask:NSViewMinXMargin];
|
||||||
[m_netCountText setAlignment:NSRightTextAlignment];
|
[m_netCountText setAlignment:NSTextAlignmentRight];
|
||||||
[m_netCountText setDrawsBackground:NO];
|
[m_netCountText setDrawsBackground:NO];
|
||||||
[m_netCountText setSelectable:NO];
|
[m_netCountText setSelectable:NO];
|
||||||
[m_netCountText setBordered:NO];
|
[m_netCountText setBordered:NO];
|
||||||
|
|
|
@ -194,7 +194,7 @@ static NSArray* GetKnownExtensions()
|
||||||
[openPanel setResolvesAliases:YES];
|
[openPanel setResolvesAliases:YES];
|
||||||
[openPanel setAllowedFileTypes:GetKnownExtensions()];
|
[openPanel setAllowedFileTypes:GetKnownExtensions()];
|
||||||
|
|
||||||
if (NSOKButton == [openPanel runModal])
|
if (NSModalResponseOK == [openPanel runModal])
|
||||||
{
|
{
|
||||||
NSArray* files = [openPanel URLs];
|
NSArray* files = [openPanel URLs];
|
||||||
NSMutableString* parameters = [NSMutableString string];
|
NSMutableString* parameters = [NSMutableString string];
|
||||||
|
@ -259,7 +259,7 @@ static NSArray* GetKnownExtensions()
|
||||||
id windowTitle = [NSString stringWithFormat:@"%s %s", GAMENAME, GetVersionString()];
|
id windowTitle = [NSString stringWithFormat:@"%s %s", GAMENAME, GetVersionString()];
|
||||||
|
|
||||||
NSRect frame = NSMakeRect(0, 0, 440, 450);
|
NSRect frame = NSMakeRect(0, 0, 440, 450);
|
||||||
window = [[NSWindow alloc] initWithContentRect:frame styleMask:NSTitledWindowMask backing:NSBackingStoreBuffered defer:NO];
|
window = [[NSWindow alloc] initWithContentRect:frame styleMask:NSWindowStyleMaskTitled backing:NSBackingStoreBuffered defer:NO];
|
||||||
[window setTitle:windowTitle];
|
[window setTitle:windowTitle];
|
||||||
|
|
||||||
NSTextField *description = [[NSTextField alloc] initWithFrame:NSMakeRect(18, 384, 402, 50)];
|
NSTextField *description = [[NSTextField alloc] initWithFrame:NSMakeRect(18, 384, 402, 50)];
|
||||||
|
|
Loading…
Reference in a new issue