winemac: Implement the Mac "Window" menu.
This commit is contained in:
parent
15d4b2ab51
commit
b3f71fdeb1
|
@ -51,7 +51,18 @@ - (void) transformProcessToForeground
|
||||||
[item setSubmenu:submenu];
|
[item setSubmenu:submenu];
|
||||||
[mainMenu addItem:item];
|
[mainMenu addItem:item];
|
||||||
|
|
||||||
|
submenu = [[[NSMenu alloc] initWithTitle:@"Window"] autorelease];
|
||||||
|
[submenu addItemWithTitle:@"Minimize" action:@selector(performMiniaturize:) keyEquivalent:@""];
|
||||||
|
[submenu addItemWithTitle:@"Zoom" action:@selector(performZoom:) keyEquivalent:@""];
|
||||||
|
[submenu addItem:[NSMenuItem separatorItem]];
|
||||||
|
[submenu addItemWithTitle:@"Bring All to Front" action:@selector(arrangeInFront:) keyEquivalent:@""];
|
||||||
|
item = [[[NSMenuItem alloc] init] autorelease];
|
||||||
|
[item setTitle:@"Window"];
|
||||||
|
[item setSubmenu:submenu];
|
||||||
|
[mainMenu addItem:item];
|
||||||
|
|
||||||
[self setMainMenu:mainMenu];
|
[self setMainMenu:mainMenu];
|
||||||
|
[self setWindowsMenu:submenu];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -172,9 +172,17 @@ - (void) setMacDrvState:(const struct macdrv_window_state*)state
|
||||||
else
|
else
|
||||||
behavior |= NSWindowCollectionBehaviorManaged;
|
behavior |= NSWindowCollectionBehaviorManaged;
|
||||||
if (state->excluded_by_cycle)
|
if (state->excluded_by_cycle)
|
||||||
|
{
|
||||||
behavior |= NSWindowCollectionBehaviorIgnoresCycle;
|
behavior |= NSWindowCollectionBehaviorIgnoresCycle;
|
||||||
|
if ([self isVisible])
|
||||||
|
[NSApp removeWindowsItem:self];
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
behavior |= NSWindowCollectionBehaviorParticipatesInCycle;
|
behavior |= NSWindowCollectionBehaviorParticipatesInCycle;
|
||||||
|
if ([self isVisible])
|
||||||
|
[NSApp addWindowsItem:self title:[self title] filename:NO];
|
||||||
|
}
|
||||||
[self setCollectionBehavior:behavior];
|
[self setCollectionBehavior:behavior];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -196,6 +204,9 @@ - (BOOL) orderBelow:(WineWindow*)prev orAbove:(WineWindow*)next
|
||||||
[latentParentWindow addChildWindow:self ordered:NSWindowAbove];
|
[latentParentWindow addChildWindow:self ordered:NSWindowAbove];
|
||||||
self.latentParentWindow = nil;
|
self.latentParentWindow = nil;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (![self isExcludedFromWindowsMenu])
|
||||||
|
[NSApp addWindowsItem:self title:[self title] filename:NO];
|
||||||
}
|
}
|
||||||
|
|
||||||
return on_screen;
|
return on_screen;
|
||||||
|
@ -206,6 +217,7 @@ - (void) doOrderOut
|
||||||
self.latentParentWindow = [self parentWindow];
|
self.latentParentWindow = [self parentWindow];
|
||||||
[latentParentWindow removeChildWindow:self];
|
[latentParentWindow removeChildWindow:self];
|
||||||
[self orderOut:nil];
|
[self orderOut:nil];
|
||||||
|
[NSApp removeWindowsItem:self];
|
||||||
}
|
}
|
||||||
|
|
||||||
- (BOOL) setFrameIfOnScreen:(NSRect)contentRect
|
- (BOOL) setFrameIfOnScreen:(NSRect)contentRect
|
||||||
|
@ -277,6 +289,18 @@ - (BOOL) canBecomeMainWindow
|
||||||
return [self canBecomeKeyWindow];
|
return [self canBecomeKeyWindow];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
- (BOOL) isExcludedFromWindowsMenu
|
||||||
|
{
|
||||||
|
return !([self collectionBehavior] & NSWindowCollectionBehaviorParticipatesInCycle);
|
||||||
|
}
|
||||||
|
|
||||||
|
- (BOOL) validateMenuItem:(NSMenuItem *)menuItem
|
||||||
|
{
|
||||||
|
if ([menuItem action] == @selector(makeKeyAndOrderFront:))
|
||||||
|
return [self isKeyWindow] || (!self.disabled && !self.noActivate);
|
||||||
|
return [super validateMenuItem:menuItem];
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* ---------- NSWindowDelegate methods ----------
|
* ---------- NSWindowDelegate methods ----------
|
||||||
|
@ -372,6 +396,8 @@ void macdrv_set_cocoa_window_title(macdrv_window w, const unsigned short* title,
|
||||||
titleString = @"";
|
titleString = @"";
|
||||||
OnMainThreadAsync(^{
|
OnMainThreadAsync(^{
|
||||||
[window setTitle:titleString];
|
[window setTitle:titleString];
|
||||||
|
if ([window isVisible] && ![window isExcludedFromWindowsMenu])
|
||||||
|
[NSApp changeWindowsItem:window title:titleString filename:NO];
|
||||||
});
|
});
|
||||||
|
|
||||||
[pool release];
|
[pool release];
|
||||||
|
|
Loading…
Reference in New Issue