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

Signed-off-by: Brendan Shanks <bshanks@codeweavers.com>
Signed-off-by: Ken Thomases <ken@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Brendan Shanks 2020-07-23 10:34:35 -07:00 committed by Alexandre Julliard
parent 587732acb7
commit 7aa2601f94
6 changed files with 111 additions and 66 deletions

View File

@ -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)

View File

@ -258,7 +258,7 @@ - (void) transformProcessToForeground
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 @@ - (void) transformProcessToForeground
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 @@ - (void) transformProcessToForeground
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 @@ - (BOOL) waitUntilQueryDone:(int*)done timeout:(NSDate*)timeout processEvents:(B
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 @@ - (void) handleWindowDrag:(NSEvent*)anEvent begin:(BOOL)begin
- (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 @@ - (void) handleMouseButton:(NSEvent*)theEvent
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 @@ - (void) handleMouseButton:(NSEvent*)theEvent
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 @@ - (void) handleMouseButton:(NSEvent*)theEvent
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 @@ - (void) handleMouseButton:(NSEvent*)theEvent
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 @@ - (BOOL) handleEvent:(NSEvent*)anEvent
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 @@ - (BOOL) handleEvent:(NSEvent*)anEvent
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 @@ - (BOOL) handleEvent:(NSEvent*)anEvent
[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 @@ - (void) didSendEvent:(NSEvent*)anEvent
{ {
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

View File

@ -44,7 +44,10 @@ @implementation NSEvent (WineExtensions)
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)
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]

View File

@ -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 @@ + (NSView*) dummyView
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];
}); });

View File

@ -117,7 +117,9 @@ - (void) postMouseButtonEvent:(NSEvent*)nsevent;
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 @@ - (void) drawRect:(NSRect)rect
[image drawAtPoint:imageOrigin [image drawAtPoint:imageOrigin
fromRect:NSZeroRect fromRect:NSZeroRect
operation:NSCompositeSourceOver operation:NSCompositingOperationSourceOver
fraction:1]; fraction:1];
} }
} }

View File

@ -41,7 +41,7 @@
NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7, NSWindowCollectionBehaviorFullScreenPrimary = 1 << 7,
NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8, NSWindowCollectionBehaviorFullScreenAuxiliary = 1 << 8,
NSWindowFullScreenButton = 7, NSWindowFullScreenButton = 7,
NSFullScreenWindowMask = 1 << 14, NSWindowStyleMaskFullScreen = 1 << 14,
}; };
@interface NSWindow (WineFullScreenExtensions) @interface NSWindow (WineFullScreenExtensions)
@ -64,13 +64,13 @@ static NSUInteger style_mask_for_features(const struct macdrv_window_features* w
if (wf->title_bar) if (wf->title_bar)
{ {
style_mask = NSTitledWindowMask; style_mask = NSWindowStyleMaskTitled;
if (wf->close_button) style_mask |= NSClosableWindowMask; if (wf->close_button) style_mask |= NSWindowStyleMaskClosable;
if (wf->minimize_button) style_mask |= NSMiniaturizableWindowMask; if (wf->minimize_button) style_mask |= NSWindowStyleMaskMiniaturizable;
if (wf->resizable || wf->maximize_button) style_mask |= NSResizableWindowMask; if (wf->resizable || wf->maximize_button) style_mask |= NSWindowStyleMaskResizable;
if (wf->utility) style_mask |= NSUtilityWindowMask; if (wf->utility) style_mask |= NSWindowStyleMaskUtilityWindow;
} }
else style_mask = NSBorderlessWindowMask; else style_mask = NSWindowStyleMaskBorderless;
return style_mask; return style_mask;
} }
@ -1058,7 +1058,7 @@ - (void) dealloc
- (BOOL) preventResizing - (BOOL) preventResizing
{ {
BOOL preventForClipping = cursor_clipping_locks_windows && [[WineApplicationController sharedController] clippingCursor]; BOOL preventForClipping = cursor_clipping_locks_windows && [[WineApplicationController sharedController] clippingCursor];
return ([self styleMask] & NSResizableWindowMask) && (disabled || !resizable || preventForClipping); return ([self styleMask] & NSWindowStyleMaskResizable) && (disabled || !resizable || preventForClipping);
} }
- (BOOL) allowsMovingWithMaximized:(BOOL)inMaximized - (BOOL) allowsMovingWithMaximized:(BOOL)inMaximized
@ -1075,11 +1075,11 @@ - (void) adjustFeaturesForState
{ {
NSUInteger style = [self styleMask]; NSUInteger style = [self styleMask];
if (style & NSClosableWindowMask) if (style & NSWindowStyleMaskClosable)
[[self standardWindowButton:NSWindowCloseButton] setEnabled:!self.disabled]; [[self standardWindowButton:NSWindowCloseButton] setEnabled:!self.disabled];
if (style & NSMiniaturizableWindowMask) if (style & NSWindowStyleMaskMiniaturizable)
[[self standardWindowButton:NSWindowMiniaturizeButton] setEnabled:!self.disabled]; [[self standardWindowButton:NSWindowMiniaturizeButton] setEnabled:!self.disabled];
if (style & NSResizableWindowMask) if (style & NSWindowStyleMaskResizable)
[[self standardWindowButton:NSWindowZoomButton] setEnabled:!self.disabled]; [[self standardWindowButton:NSWindowZoomButton] setEnabled:!self.disabled];
if ([self respondsToSelector:@selector(toggleFullScreen:)]) if ([self respondsToSelector:@selector(toggleFullScreen:)])
{ {
@ -1110,7 +1110,7 @@ - (void) adjustFullScreenBehavior:(NSWindowCollectionBehavior)behavior
NSUInteger style = [self styleMask]; NSUInteger style = [self styleMask];
if (behavior & NSWindowCollectionBehaviorParticipatesInCycle && if (behavior & NSWindowCollectionBehaviorParticipatesInCycle &&
style & NSResizableWindowMask && !(style & NSUtilityWindowMask) && !maximized && style & NSWindowStyleMaskResizable && !(style & NSWindowStyleMaskUtilityWindow) && !maximized &&
!(self.parentWindow || self.latentParentWindow)) !(self.parentWindow || self.latentParentWindow))
{ {
behavior |= NSWindowCollectionBehaviorFullScreenPrimary; behavior |= NSWindowCollectionBehaviorFullScreenPrimary;
@ -1120,7 +1120,7 @@ - (void) adjustFullScreenBehavior:(NSWindowCollectionBehavior)behavior
{ {
behavior &= ~NSWindowCollectionBehaviorFullScreenPrimary; behavior &= ~NSWindowCollectionBehaviorFullScreenPrimary;
behavior |= NSWindowCollectionBehaviorFullScreenAuxiliary; behavior |= NSWindowCollectionBehaviorFullScreenAuxiliary;
if (style & NSFullScreenWindowMask) if (style & NSWindowStyleMaskFullScreen)
[super toggleFullScreen:nil]; [super toggleFullScreen:nil];
} }
} }
@ -1134,24 +1134,24 @@ - (void) adjustFullScreenBehavior:(NSWindowCollectionBehavior)behavior
- (void) setWindowFeatures:(const struct macdrv_window_features*)wf - (void) setWindowFeatures:(const struct macdrv_window_features*)wf
{ {
static const NSUInteger usedStyles = NSTitledWindowMask | NSClosableWindowMask | NSMiniaturizableWindowMask | static const NSUInteger usedStyles = NSWindowStyleMaskTitled | NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable |
NSResizableWindowMask | NSUtilityWindowMask | NSBorderlessWindowMask; NSWindowStyleMaskResizable | NSWindowStyleMaskUtilityWindow | NSWindowStyleMaskBorderless;
NSUInteger currentStyle = [self styleMask]; NSUInteger currentStyle = [self styleMask];
NSUInteger newStyle = style_mask_for_features(wf) | (currentStyle & ~usedStyles); NSUInteger newStyle = style_mask_for_features(wf) | (currentStyle & ~usedStyles);
if (newStyle != currentStyle) if (newStyle != currentStyle)
{ {
NSString* title = [[[self title] copy] autorelease]; NSString* title = [[[self title] copy] autorelease];
BOOL showingButtons = (currentStyle & (NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask)) != 0; BOOL showingButtons = (currentStyle & (NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable)) != 0;
BOOL shouldShowButtons = (newStyle & (NSClosableWindowMask | NSMiniaturizableWindowMask | NSResizableWindowMask)) != 0; BOOL shouldShowButtons = (newStyle & (NSWindowStyleMaskClosable | NSWindowStyleMaskMiniaturizable | NSWindowStyleMaskResizable)) != 0;
if (shouldShowButtons != showingButtons && !((newStyle ^ currentStyle) & NSClosableWindowMask)) if (shouldShowButtons != showingButtons && !((newStyle ^ currentStyle) & NSWindowStyleMaskClosable))
{ {
// -setStyleMask: is buggy on 10.7+ with respect to NSResizableWindowMask. // -setStyleMask: is buggy on 10.7+ with respect to NSWindowStyleMaskResizable.
// If transitioning from NSTitledWindowMask | NSResizableWindowMask to // If transitioning from NSWindowStyleMaskTitled | NSWindowStyleMaskResizable to
// just NSTitledWindowMask, the window buttons should disappear rather // just NSWindowStyleMaskTitled, the window buttons should disappear rather
// than just being disabled. But they don't. Similarly in reverse. // than just being disabled. But they don't. Similarly in reverse.
// The workaround is to also toggle NSClosableWindowMask at the same time. // The workaround is to also toggle NSWindowStyleMaskClosable at the same time.
[self setStyleMask:newStyle ^ NSClosableWindowMask]; [self setStyleMask:newStyle ^ NSWindowStyleMaskClosable];
} }
[self setStyleMask:newStyle]; [self setStyleMask:newStyle];
@ -1283,14 +1283,14 @@ - (void) setMacDrvState:(const struct macdrv_window_state*)state
{ {
if ([self wouldBeVisible]) if ([self wouldBeVisible])
{ {
if ([self styleMask] & NSFullScreenWindowMask) if ([self styleMask] & NSWindowStyleMaskFullScreen)
{ {
[self postDidUnminimizeEvent]; [self postDidUnminimizeEvent];
discard &= ~event_mask_for_type(WINDOW_DID_UNMINIMIZE); discard &= ~event_mask_for_type(WINDOW_DID_UNMINIMIZE);
} }
else else
{ {
[self setStyleMask:([self styleMask] | NSMiniaturizableWindowMask)]; [self setStyleMask:([self styleMask] | NSWindowStyleMaskMiniaturizable)];
[super miniaturize:nil]; [super miniaturize:nil];
discard |= event_mask_for_type(WINDOW_BROUGHT_FORWARD) | discard |= event_mask_for_type(WINDOW_BROUGHT_FORWARD) |
event_mask_for_type(WINDOW_GOT_FOCUS) | event_mask_for_type(WINDOW_GOT_FOCUS) |
@ -1765,7 +1765,7 @@ - (void) orderBelow:(WineWindow*)prev orAbove:(WineWindow*)next activate:(BOOL)a
if (pendingMinimize) if (pendingMinimize)
{ {
[self setStyleMask:([self styleMask] | NSMiniaturizableWindowMask)]; [self setStyleMask:([self styleMask] | NSWindowStyleMaskMiniaturizable)];
[super miniaturize:nil]; [super miniaturize:nil];
pendingMinimize = FALSE; pendingMinimize = FALSE;
} }
@ -1814,7 +1814,7 @@ - (void) doOrderOut
[parent grabDockIconSnapshotFromWindow:self force:NO]; [parent grabDockIconSnapshotFromWindow:self force:NO];
[self becameIneligibleParentOrChild]; [self becameIneligibleParentOrChild];
if ([self isMiniaturized] || [self styleMask] & NSFullScreenWindowMask) if ([self isMiniaturized] || [self styleMask] & NSWindowStyleMaskFullScreen)
{ {
fakingClose = TRUE; fakingClose = TRUE;
[self close]; [self close];
@ -1844,7 +1844,7 @@ - (void) doOrderOut
- (void) updateFullscreen - (void) updateFullscreen
{ {
NSRect contentRect = [self contentRectForFrameRect:self.wine_fractionalFrame]; NSRect contentRect = [self contentRectForFrameRect:self.wine_fractionalFrame];
BOOL nowFullscreen = !([self styleMask] & NSFullScreenWindowMask) && screen_covered_by_rect(contentRect, [NSScreen screens]); BOOL nowFullscreen = !([self styleMask] & NSWindowStyleMaskFullScreen) && screen_covered_by_rect(contentRect, [NSScreen screens]);
if (nowFullscreen != fullscreen) if (nowFullscreen != fullscreen)
{ {
@ -2077,7 +2077,7 @@ - (void) postKeyEvent:(NSEvent *)theEvent
{ {
[self flagsChanged:theEvent]; [self flagsChanged:theEvent];
[self postKey:[theEvent keyCode] [self postKey:[theEvent keyCode]
pressed:[theEvent type] == NSKeyDown pressed:[theEvent type] == NSEventTypeKeyDown
modifiers:adjusted_modifiers_for_settings([theEvent modifierFlags]) modifiers:adjusted_modifiers_for_settings([theEvent modifierFlags])
event:theEvent]; event:theEvent];
} }
@ -2120,9 +2120,9 @@ - (void) postWindowFrameChanged:(NSRect)frame fullscreen:(BOOL)isFullscreen resi
NSUInteger style = self.styleMask; NSUInteger style = self.styleMask;
if (isFullscreen) if (isFullscreen)
style |= NSFullScreenWindowMask; style |= NSWindowStyleMaskFullScreen;
else else
style &= ~NSFullScreenWindowMask; style &= ~NSWindowStyleMaskFullScreen;
frame = [[self class] contentRectForFrameRect:frame styleMask:style]; frame = [[self class] contentRectForFrameRect:frame styleMask:style];
[[WineApplicationController sharedController] flipRect:&frame]; [[WineApplicationController sharedController] flipRect:&frame];
@ -2302,7 +2302,7 @@ - (void) grabDockIconSnapshotFromWindow:(WineWindow*)window force:(BOOL)force
CGContextDrawImage(cgcontext, rect, windowImage); CGContextDrawImage(cgcontext, rect, windowImage);
[appImage drawInRect:NSMakeRect(156, 4, 96, 96) [appImage drawInRect:NSMakeRect(156, 4, 96, 96)
fromRect:NSZeroRect fromRect:NSZeroRect
operation:NSCompositeSourceOver operation:NSCompositingOperationSourceOver
fraction:1 fraction:1
respectFlipped:YES respectFlipped:YES
hints:nil]; hints:nil];
@ -2431,13 +2431,13 @@ - (void) sendEvent:(NSEvent*)event
interface control. For example, Control-Tab switches focus among interface control. For example, Control-Tab switches focus among
views. We want to bypass that feature, so directly route key-down views. We want to bypass that feature, so directly route key-down
events to -keyDown:. */ events to -keyDown:. */
if (type == NSKeyDown) if (type == NSEventTypeKeyDown)
[[self firstResponder] keyDown:event]; [[self firstResponder] keyDown:event];
else else
{ {
if (!draggingPhase && maximized && ![self isMovable] && if (!draggingPhase && maximized && ![self isMovable] &&
![self allowsMovingWithMaximized:YES] && [self allowsMovingWithMaximized:NO] && ![self allowsMovingWithMaximized:YES] && [self allowsMovingWithMaximized:NO] &&
type == NSLeftMouseDown && (self.styleMask & NSTitledWindowMask)) type == NSEventTypeLeftMouseDown && (self.styleMask & NSWindowStyleMaskTitled))
{ {
NSRect titleBar = self.frame; NSRect titleBar = self.frame;
NSRect contentRect = [self contentRectForFrameRect:titleBar]; NSRect contentRect = [self contentRectForFrameRect:titleBar];
@ -2480,7 +2480,7 @@ - (void) sendEvent:(NSEvent*)event
} }
} }
} }
else if (draggingPhase && (type == NSLeftMouseDragged || type == NSLeftMouseUp)) else if (draggingPhase && (type == NSEventTypeLeftMouseDragged || type == NSEventTypeLeftMouseUp))
{ {
if ([self isMovable]) if ([self isMovable])
{ {
@ -2502,7 +2502,7 @@ - (void) sendEvent:(NSEvent*)event
[self setFrameTopLeftPoint:newTopLeft]; [self setFrameTopLeftPoint:newTopLeft];
} }
else if (draggingPhase == 1 && type == NSLeftMouseDragged) else if (draggingPhase == 1 && type == NSEventTypeLeftMouseDragged)
{ {
macdrv_event* event; macdrv_event* event;
NSRect frame = [self contentRectForFrameRect:self.frame]; NSRect frame = [self contentRectForFrameRect:self.frame];
@ -2518,7 +2518,7 @@ - (void) sendEvent:(NSEvent*)event
draggingPhase = 2; draggingPhase = 2;
} }
if (type == NSLeftMouseUp) if (type == NSEventTypeLeftMouseUp)
[self endWindowDragging]; [self endWindowDragging];
} }
@ -2919,7 +2919,7 @@ - (void)windowDidResize:(NSNotification *)notification
} }
[self postWindowFrameChanged:frame [self postWindowFrameChanged:frame
fullscreen:([self styleMask] & NSFullScreenWindowMask) != 0 fullscreen:([self styleMask] & NSWindowStyleMaskFullScreen) != 0
resizing:[self inLiveResize]]; resizing:[self inLiveResize]];
[[[self contentView] inputContext] invalidateCharacterCoordinates]; [[[self contentView] inputContext] invalidateCharacterCoordinates];