Fixed: some window subclasses should not be constrained to the usable screen content

Previously, all window subclasses were constrained to the usable screen content. Unfortunately that included the menu bar window, which ended up appearing below itself!

This commit introduces an ivar that indicates whether instances of the window subclass should be constrained or not.
This commit is contained in:
Aparajita Fishman
2013-03-12 15:00:26 -04:00
parent bbfaac5468
commit 69bda9427a
6 changed files with 27 additions and 0 deletions
+2
View File
@@ -67,6 +67,8 @@
if (self)
{
_constrainsToUsableScreen = NO;
[self setLevel:CPMainMenuWindowLevel];
[self setAutoresizingMask:CPWindowWidthSizable];
+2
View File
@@ -87,6 +87,8 @@ _CPMenuWindowAttachedMenuBackgroundStyle = 2;
if (self)
{
_constrainsToUsableScreen = NO;
[self setLevel:CPPopUpMenuWindowLevel];
[self setHasShadow:YES];
[self setShadowStyle:CPMenuWindowShadowStyle];
+5
View File
@@ -144,6 +144,7 @@ var CPWindowActionMessageKeys = [
BOOL _hasShadow;
BOOL _isMovableByWindowBackground;
BOOL _isMovable;
BOOL _constrainsToUsableScreen;
unsigned _shadowStyle;
BOOL _showsResizeIndicator;
@@ -253,6 +254,7 @@ CPTexturedBackgroundWindowMask
var windowViewClass = [[self class] _windowViewClassForStyleMask:aStyleMask];
_frame = [windowViewClass frameRectForContentRect:aContentRect];
_constrainsToUsableScreen = YES;
[self _setSharesChromeWithPlatformWindow:![CPPlatform isBrowser]];
@@ -729,6 +731,9 @@ CPTexturedBackgroundWindowMask
- (CGRect)_pinFrame:(CGRect)aFrame toUsableScreenWidth:(BOOL)pinWidth andHeight:(BOOL)pinHeight
{
if (!_constrainsToUsableScreen)
return CGRectMakeCopy(aFrame);
var usableRect = [_platformWindow usableContentFrame],
frame = _CGRectMakeCopy(aFrame);
+8
View File
@@ -270,6 +270,14 @@ var _CPAutocompleteMenuMaximumHeight = 307;
@implementation _CPAutocompleteWindow : CPPanel
- (id)initWithContentRect:(CGRect)aContentRect styleMask:(unsigned int)aStyleMask
{
if (self = [super initWithContentRect:aContentRect styleMask:aStyleMask])
_constrainsToUsableScreen = NO;
return self;
}
- (BOOL)becomesKeyOnlyIfNeeded
{
return YES;
+8
View File
@@ -852,6 +852,14 @@ var _CPPopUpListDataSourceKey = @"_CPPopUpListDataSourceKey",
@implementation _CPPopUpPanel : CPPanel
- (id)initWithContentRect:(CGRect)aContentRect styleMask:(unsigned int)aStyleMask
{
if (self = [super initWithContentRect:aContentRect styleMask:aStyleMask])
_constrainsToUsableScreen = NO;
return self;
}
- (void)sendEvent:(CPEvent)anEvent
{
var type = [anEvent type];
+2
View File
@@ -167,6 +167,8 @@ var _CPToolTipHeight = 24.0,
if (self = [super initWithContentRect:toolTipFrame styleMask:aStyleMask])
{
_constrainsToUsableScreen = NO;
textFrameSize.height += 4;
_content = [CPTextField labelWithTitle:aString];