Commit 7aa2601f authored by Brendan Shanks's avatar Brendan Shanks Committed by Alexandre Julliard

winemac.drv: Fix warnings for constants deprecated by macOS 10.12.

parent 587732ac
...@@ -22,6 +22,41 @@ ...@@ -22,6 +22,41 @@
#include "macdrv_cocoa.h" #include "macdrv_cocoa.h"
#if !defined(MAC_OS_X_VERSION_10_12) || MAC_OS_X_VERSION_MAX_ALLOWED < MAC_OS_X_VERSION_10_12
/* For older SDKs, #define the new names of constants deprecated/renamed in macOS 10.12. */
#define NSCompositingOperationSourceOver NSCompositeSourceOver
#define NSEventMaskAny NSAnyEventMask
#define NSEventMaskLeftMouseDown NSLeftMouseDownMask
#define NSEventMaskOtherMouseDown NSOtherMouseDownMask
#define NSEventMaskRightMouseDown NSRightMouseDownMask
#define NSEventModifierFlagCommand NSCommandKeyMask
#define NSEventModifierFlagControl NSControlKeyMask
#define NSEventModifierFlagOption NSAlternateKeyMask
#define NSEventModifierFlagShift NSShiftKeyMask
#define NSEventTypeAppKitDefined NSAppKitDefined
#define NSEventTypeApplicationDefined NSApplicationDefined
#define NSEventTypeFlagsChanged NSFlagsChanged
#define NSEventTypeKeyDown NSKeyDown
#define NSEventTypeKeyUp NSKeyUp
#define NSEventTypeLeftMouseDown NSLeftMouseDown
#define NSEventTypeLeftMouseDragged NSLeftMouseDragged
#define NSEventTypeLeftMouseUp NSLeftMouseUp
#define NSEventTypeMouseMoved NSMouseMoved
#define NSEventTypeOtherMouseDown NSOtherMouseDown
#define NSEventTypeOtherMouseDragged NSOtherMouseDragged
#define NSEventTypeOtherMouseUp NSOtherMouseUp
#define NSEventTypeRightMouseDown NSRightMouseDown
#define NSEventTypeRightMouseUp NSRightMouseUp
#define NSEventTypeRightMouseDragged NSRightMouseDragged
#define NSEventTypeScrollWheel NSScrollWheel
#define NSWindowStyleMaskBorderless NSBorderlessWindowMask
#define NSWindowStyleMaskClosable NSClosableWindowMask
#define NSWindowStyleMaskFullScreen NSFullScreenWindowMask
#define NSWindowStyleMaskMiniaturizable NSMiniaturizableWindowMask
#define NSWindowStyleMaskResizable NSResizableWindowMask
#define NSWindowStyleMaskTitled NSTitledWindowMask
#define NSWindowStyleMaskUtilityWindow NSUtilityWindowMask
#endif
#define ERR(...) do { if (macdrv_err_on) LogError(__func__, __VA_ARGS__); } while (false) #define ERR(...) do { if (macdrv_err_on) LogError(__func__, __VA_ARGS__); } while (false)
......
...@@ -258,7 +258,7 @@ static NSString* WineLocalizedString(unsigned int stringID) ...@@ -258,7 +258,7 @@ static NSString* WineLocalizedString(unsigned int stringID)
item = [submenu addItemWithTitle:WineLocalizedString(STRING_MENU_ITEM_HIDE_OTHERS) item = [submenu addItemWithTitle:WineLocalizedString(STRING_MENU_ITEM_HIDE_OTHERS)
action:@selector(hideOtherApplications:) action:@selector(hideOtherApplications:)
keyEquivalent:@"h"]; keyEquivalent:@"h"];
[item setKeyEquivalentModifierMask:NSCommandKeyMask | NSAlternateKeyMask]; [item setKeyEquivalentModifierMask:NSEventModifierFlagCommand | NSEventModifierFlagOption];
item = [submenu addItemWithTitle:WineLocalizedString(STRING_MENU_ITEM_SHOW_ALL) item = [submenu addItemWithTitle:WineLocalizedString(STRING_MENU_ITEM_SHOW_ALL)
action:@selector(unhideAllApplications:) action:@selector(unhideAllApplications:)
...@@ -271,7 +271,7 @@ static NSString* WineLocalizedString(unsigned int stringID) ...@@ -271,7 +271,7 @@ static NSString* WineLocalizedString(unsigned int stringID)
else else
title = WineLocalizedString(STRING_MENU_ITEM_QUIT); title = WineLocalizedString(STRING_MENU_ITEM_QUIT);
item = [submenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"]; item = [submenu addItemWithTitle:title action:@selector(terminate:) keyEquivalent:@"q"];
[item setKeyEquivalentModifierMask:NSCommandKeyMask | NSAlternateKeyMask]; [item setKeyEquivalentModifierMask:NSEventModifierFlagCommand | NSEventModifierFlagOption];
item = [[[NSMenuItem alloc] init] autorelease]; item = [[[NSMenuItem alloc] init] autorelease];
[item setTitle:WineLocalizedString(STRING_MENU_WINE)]; [item setTitle:WineLocalizedString(STRING_MENU_WINE)];
[item setSubmenu:submenu]; [item setSubmenu:submenu];
...@@ -290,7 +290,9 @@ static NSString* WineLocalizedString(unsigned int stringID) ...@@ -290,7 +290,9 @@ static NSString* WineLocalizedString(unsigned int stringID)
item = [submenu addItemWithTitle:WineLocalizedString(STRING_MENU_ITEM_ENTER_FULL_SCREEN) item = [submenu addItemWithTitle:WineLocalizedString(STRING_MENU_ITEM_ENTER_FULL_SCREEN)
action:@selector(toggleFullScreen:) action:@selector(toggleFullScreen:)
keyEquivalent:@"f"]; keyEquivalent:@"f"];
[item setKeyEquivalentModifierMask:NSCommandKeyMask | NSAlternateKeyMask | NSControlKeyMask]; [item setKeyEquivalentModifierMask:NSEventModifierFlagCommand |
NSEventModifierFlagOption |
NSEventModifierFlagControl];
} }
[submenu addItem:[NSMenuItem separatorItem]]; [submenu addItem:[NSMenuItem separatorItem]];
[submenu addItemWithTitle:WineLocalizedString(STRING_MENU_ITEM_BRING_ALL_TO_FRONT) [submenu addItemWithTitle:WineLocalizedString(STRING_MENU_ITEM_BRING_ALL_TO_FRONT)
...@@ -317,7 +319,7 @@ static NSString* WineLocalizedString(unsigned int stringID) ...@@ -317,7 +319,7 @@ static NSString* WineLocalizedString(unsigned int stringID)
if (processEvents) if (processEvents)
{ {
NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init]; NSAutoreleasePool* pool = [[NSAutoreleasePool alloc] init];
NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask NSEvent* event = [NSApp nextEventMatchingMask:NSEventMaskAny
untilDate:timeout untilDate:timeout
inMode:NSDefaultRunLoopMode inMode:NSDefaultRunLoopMode
dequeue:YES]; dequeue:YES];
...@@ -1607,7 +1609,7 @@ static NSString* WineLocalizedString(unsigned int stringID) ...@@ -1607,7 +1609,7 @@ static NSString* WineLocalizedString(unsigned int stringID)
- (void) handleMouseMove:(NSEvent*)anEvent - (void) handleMouseMove:(NSEvent*)anEvent
{ {
WineWindow* targetWindow; WineWindow* targetWindow;
BOOL drag = [anEvent type] != NSMouseMoved; BOOL drag = [anEvent type] != NSEventTypeMouseMoved;
if ([windowsBeingDragged count]) if ([windowsBeingDragged count])
targetWindow = nil; targetWindow = nil;
...@@ -1758,11 +1760,11 @@ static NSString* WineLocalizedString(unsigned int stringID) ...@@ -1758,11 +1760,11 @@ static NSString* WineLocalizedString(unsigned int stringID)
WineWindow* windowBroughtForward = nil; WineWindow* windowBroughtForward = nil;
BOOL process = FALSE; BOOL process = FALSE;
if (type == NSLeftMouseUp && [windowsBeingDragged count]) if (type == NSEventTypeLeftMouseUp && [windowsBeingDragged count])
[self handleWindowDrag:theEvent begin:NO]; [self handleWindowDrag:theEvent begin:NO];
if ([window isKindOfClass:[WineWindow class]] && if ([window isKindOfClass:[WineWindow class]] &&
type == NSLeftMouseDown && type == NSEventTypeLeftMouseDown &&
![theEvent wine_commandKeyDown]) ![theEvent wine_commandKeyDown])
{ {
NSWindowButton windowButton; NSWindowButton windowButton;
...@@ -1795,7 +1797,9 @@ static NSString* WineLocalizedString(unsigned int stringID) ...@@ -1795,7 +1797,9 @@ static NSString* WineLocalizedString(unsigned int stringID)
if ([window isKindOfClass:[WineWindow class]]) if ([window isKindOfClass:[WineWindow class]])
{ {
BOOL pressed = (type == NSLeftMouseDown || type == NSRightMouseDown || type == NSOtherMouseDown); BOOL pressed = (type == NSEventTypeLeftMouseDown ||
type == NSEventTypeRightMouseDown ||
type == NSEventTypeOtherMouseDown);
CGPoint pt = CGEventGetLocation([theEvent CGEvent]); CGPoint pt = CGEventGetLocation([theEvent CGEvent]);
if (clippingCursor) if (clippingCursor)
...@@ -1811,7 +1815,7 @@ static NSString* WineLocalizedString(unsigned int stringID) ...@@ -1811,7 +1815,7 @@ static NSString* WineLocalizedString(unsigned int stringID)
NSPoint nspoint = [self flippedMouseLocation:NSPointFromCGPoint(pt)]; NSPoint nspoint = [self flippedMouseLocation:NSPointFromCGPoint(pt)];
NSRect contentRect = [window contentRectForFrameRect:[window frame]]; NSRect contentRect = [window contentRectForFrameRect:[window frame]];
process = NSMouseInRect(nspoint, contentRect, NO); process = NSMouseInRect(nspoint, contentRect, NO);
if (process && [window styleMask] & NSResizableWindowMask) if (process && [window styleMask] & NSWindowStyleMaskResizable)
{ {
// Ignore clicks in the grow box (resize widget). // Ignore clicks in the grow box (resize widget).
HIPoint origin = { 0, 0 }; HIPoint origin = { 0, 0 };
...@@ -1821,7 +1825,7 @@ static NSString* WineLocalizedString(unsigned int stringID) ...@@ -1821,7 +1825,7 @@ static NSString* WineLocalizedString(unsigned int stringID)
info.kind = kHIThemeGrowBoxKindNormal; info.kind = kHIThemeGrowBoxKindNormal;
info.direction = kThemeGrowRight | kThemeGrowDown; info.direction = kThemeGrowRight | kThemeGrowDown;
if ([window styleMask] & NSUtilityWindowMask) if ([window styleMask] & NSWindowStyleMaskUtilityWindow)
info.size = kHIThemeGrowBoxSizeSmall; info.size = kHIThemeGrowBoxSizeSmall;
else else
info.size = kHIThemeGrowBoxSizeNormal; info.size = kHIThemeGrowBoxSizeNormal;
...@@ -2063,27 +2067,27 @@ static NSString* WineLocalizedString(unsigned int stringID) ...@@ -2063,27 +2067,27 @@ static NSString* WineLocalizedString(unsigned int stringID)
BOOL ret = FALSE; BOOL ret = FALSE;
NSEventType type = [anEvent type]; NSEventType type = [anEvent type];
if (type == NSFlagsChanged) if (type == NSEventTypeFlagsChanged)
self.lastFlagsChanged = anEvent; self.lastFlagsChanged = anEvent;
else if (type == NSMouseMoved || type == NSLeftMouseDragged || else if (type == NSEventTypeMouseMoved || type == NSEventTypeLeftMouseDragged ||
type == NSRightMouseDragged || type == NSOtherMouseDragged) type == NSEventTypeRightMouseDragged || type == NSEventTypeOtherMouseDragged)
{ {
[self handleMouseMove:anEvent]; [self handleMouseMove:anEvent];
ret = mouseCaptureWindow && ![windowsBeingDragged count]; ret = mouseCaptureWindow && ![windowsBeingDragged count];
} }
else if (type == NSLeftMouseDown || type == NSLeftMouseUp || else if (type == NSEventTypeLeftMouseDown || type == NSEventTypeLeftMouseUp ||
type == NSRightMouseDown || type == NSRightMouseUp || type == NSEventTypeRightMouseDown || type == NSEventTypeRightMouseUp ||
type == NSOtherMouseDown || type == NSOtherMouseUp) type == NSEventTypeOtherMouseDown || type == NSEventTypeOtherMouseUp)
{ {
[self handleMouseButton:anEvent]; [self handleMouseButton:anEvent];
ret = mouseCaptureWindow && ![windowsBeingDragged count]; ret = mouseCaptureWindow && ![windowsBeingDragged count];
} }
else if (type == NSScrollWheel) else if (type == NSEventTypeScrollWheel)
{ {
[self handleScrollWheel:anEvent]; [self handleScrollWheel:anEvent];
ret = mouseCaptureWindow != nil; ret = mouseCaptureWindow != nil;
} }
else if (type == NSKeyDown) else if (type == NSEventTypeKeyDown)
{ {
// -[NSApplication sendEvent:] seems to consume presses of the Help // -[NSApplication sendEvent:] seems to consume presses of the Help
// key (Insert key on PC keyboards), so we have to bypass it and // key (Insert key on PC keyboards), so we have to bypass it and
...@@ -2094,7 +2098,7 @@ static NSString* WineLocalizedString(unsigned int stringID) ...@@ -2094,7 +2098,7 @@ static NSString* WineLocalizedString(unsigned int stringID)
ret = TRUE; ret = TRUE;
} }
} }
else if (type == NSKeyUp) else if (type == NSEventTypeKeyUp)
{ {
uint16_t keyCode = [anEvent keyCode]; uint16_t keyCode = [anEvent keyCode];
if ([self isKeyPressed:keyCode]) if ([self isKeyPressed:keyCode])
...@@ -2105,7 +2109,7 @@ static NSString* WineLocalizedString(unsigned int stringID) ...@@ -2105,7 +2109,7 @@ static NSString* WineLocalizedString(unsigned int stringID)
[window postKeyEvent:anEvent]; [window postKeyEvent:anEvent];
} }
} }
else if (type == NSAppKitDefined) else if (type == NSEventTypeAppKitDefined)
{ {
short subtype = [anEvent subtype]; short subtype = [anEvent subtype];
...@@ -2123,11 +2127,11 @@ static NSString* WineLocalizedString(unsigned int stringID) ...@@ -2123,11 +2127,11 @@ static NSString* WineLocalizedString(unsigned int stringID)
{ {
NSEventType type = [anEvent type]; NSEventType type = [anEvent type];
if (type == NSKeyDown && ![anEvent isARepeat] && [anEvent keyCode] == kVK_Tab) if (type == NSEventTypeKeyDown && ![anEvent isARepeat] && [anEvent keyCode] == kVK_Tab)
{ {
NSUInteger modifiers = [anEvent modifierFlags]; NSUInteger modifiers = [anEvent modifierFlags];
if ((modifiers & NSCommandKeyMask) && if ((modifiers & NSEventModifierFlagCommand) &&
!(modifiers & (NSControlKeyMask | NSAlternateKeyMask))) !(modifiers & (NSEventModifierFlagControl | NSEventModifierFlagOption)))
{ {
// Command-Tab and Command-Shift-Tab would normally be intercepted // Command-Tab and Command-Shift-Tab would normally be intercepted
// by the system to switch applications. If we're seeing it, it's // by the system to switch applications. If we're seeing it, it's
......
...@@ -44,7 +44,10 @@ static const OSType WineHotKeySignature = 'Wine'; ...@@ -44,7 +44,10 @@ static const OSType WineHotKeySignature = 'Wine';
static BOOL wine_commandKeyDown(NSUInteger flags) static BOOL wine_commandKeyDown(NSUInteger flags)
{ {
return ((flags & (NSShiftKeyMask | NSControlKeyMask | NSAlternateKeyMask | NSCommandKeyMask)) == NSCommandKeyMask); return ((flags & (NSEventModifierFlagShift |
NSEventModifierFlagControl |
NSEventModifierFlagOption |
NSEventModifierFlagCommand)) == NSEventModifierFlagCommand);
} }
+ (BOOL) wine_commandKeyDown + (BOOL) wine_commandKeyDown
...@@ -754,7 +757,7 @@ void macdrv_set_query_done(macdrv_query *query) ...@@ -754,7 +757,7 @@ void macdrv_set_query_done(macdrv_query *query)
query->done = TRUE; query->done = TRUE;
macdrv_release_query(query); macdrv_release_query(query);
event = [NSEvent otherEventWithType:NSApplicationDefined event = [NSEvent otherEventWithType:NSEventTypeApplicationDefined
location:NSZeroPoint location:NSZeroPoint
modifierFlags:0 modifierFlags:0
timestamp:[[NSProcessInfo processInfo] systemUptime] timestamp:[[NSProcessInfo processInfo] systemUptime]
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#import "cocoa_opengl.h" #import "cocoa_opengl.h"
#include "macdrv_cocoa.h" #include "macdrv_cocoa.h"
#include "cocoa_app.h"
#include "cocoa_event.h" #include "cocoa_event.h"
...@@ -53,7 +54,7 @@ ...@@ -53,7 +54,7 @@
dispatch_once(&once, ^{ dispatch_once(&once, ^{
OnMainThread(^{ OnMainThread(^{
dummyWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 100, 100) dummyWindow = [[NSWindow alloc] initWithContentRect:NSMakeRect(0, 0, 100, 100)
styleMask:NSBorderlessWindowMask styleMask:NSWindowStyleMaskBorderless
backing:NSBackingStoreBuffered backing:NSBackingStoreBuffered
defer:NO]; defer:NO];
}); });
......
...@@ -117,7 +117,9 @@ ...@@ -117,7 +117,9 @@
event = macdrv_create_event(STATUS_ITEM_MOUSE_BUTTON, nil); event = macdrv_create_event(STATUS_ITEM_MOUSE_BUTTON, nil);
event->status_item_mouse_button.item = (macdrv_status_item)self; event->status_item_mouse_button.item = (macdrv_status_item)self;
event->status_item_mouse_button.button = [nsevent buttonNumber]; event->status_item_mouse_button.button = [nsevent buttonNumber];
event->status_item_mouse_button.down = (typeMask & (NSLeftMouseDownMask | NSRightMouseDownMask | NSOtherMouseDownMask)) != 0; event->status_item_mouse_button.down = (typeMask & (NSEventMaskLeftMouseDown |
NSEventMaskRightMouseDown |
NSEventMaskOtherMouseDown)) != 0;
event->status_item_mouse_button.count = [nsevent clickCount]; event->status_item_mouse_button.count = [nsevent clickCount];
event->status_item_mouse_button.x = floor(point.x); event->status_item_mouse_button.x = floor(point.x);
event->status_item_mouse_button.y = floor(point.y); event->status_item_mouse_button.y = floor(point.y);
...@@ -147,7 +149,7 @@ ...@@ -147,7 +149,7 @@
[image drawAtPoint:imageOrigin [image drawAtPoint:imageOrigin
fromRect:NSZeroRect fromRect:NSZeroRect
operation:NSCompositeSourceOver operation:NSCompositingOperationSourceOver
fraction:1]; fraction:1];
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment