Remove global references to first window.

Reviewed by me.
This commit is contained in:
Francisco Ryan Tolmasky I committed 2009-07-27 12:06:07 -07:00
1 parent d2b1df88e8
commit 4d179b1db7
4 files changed
+31 -11

No files matched your search

+1 -1
View File
@@ -336,7 +336,7 @@ CPTexturedBackgroundWindowMask
if (self)
{
_platformWindow = window.firstWindow;
[self setPlatformWindow:[CPPlatformWindow primaryPlatformWindow]];
_isFullBridge = NO;
_registeredDraggedTypes = [CPSet set];
+1 -1
View File
@@ -21,7 +21,7 @@
#endif
[CPPlatformString bootstrap];
window.firstWindow = [[CPPlatformWindow alloc] _init];
[CPPlatformWindow setPrimaryPlatformWindow:[[CPPlatformWindow alloc] _init]];
}
@end
+21 -1
View File
@@ -5,13 +5,33 @@
#import "../CoreGraphics/CGGeometry.h"
var PlatformWindowClass = NULL;
var PlatformWindowClass = NULL,
PrimaryPlatformWindow = NULL;
@implementation CPPlatformWindow : CPObject
{
CGRect _contentRect;
}
+ (CPPlatformWindow)primaryPlatformWindow
{
return PrimaryPlatformWindow;
}
+ (void)setPrimaryPlatformWindow:(CPPlatformWindow)aPlatformWindow
{
PrimaryPlatformWindow = aPlatformWindow;
}
/*
+ (BOOL)supportsMultipleWindows
{
#if PLATFORM(BROWSER)
return YES;
#else
return NO;
#endif
}
*/
+ (void)_setPlatformWindowClass:(Class)aClass
{
PlatformWindowClass = aClass;
+8 -8
View File
@@ -73,12 +73,12 @@ var CPDOMWindowGetFrame,
- (CGRect)visibleFrame
{
return [window.firstWindow usableContentFrame];
return [[CPPlatformWindow primaryPlatformWindow] usableContentFrame];
}
- (CPRect)contentBounds
{
var contentBounds = [window.firstWindow contentRect];
var contentBounds = [[CPPlatformWindow primaryPlatformWindow] contentRect];
contentBounds.origin = CGPointMake(0,0);
return contentBounds;
@@ -86,34 +86,34 @@ var CPDOMWindowGetFrame,
- (CPArray)orderedWindowsAtLevel:(int)aLevel
{
return [window.firstWindow orderedWindowsAtLevel:aLevel];
return [[CPPlatformWindow primaryPlatformWindow] orderedWindowsAtLevel:aLevel];
}
- (CPDOMWindowLayer)layerAtLevel:(int)aLevel create:(BOOL)aFlag
{
return [window.firstWindow layerAtLevel:aLevel create:aFlag];
return [[CPPlatformWindow primaryPlatformWindow] layerAtLevel:aLevel create:aFlag];
}
- (void)order:(CPWindowOrderingMode)aPlace window:(CPWindow)aWindow relativeTo:(CPWindow)otherWindow
{
return [window.firstWindow order:aPlace window:aWindow relativeTo:otherWindow];
return [[CPPlatformWindow primaryPlatformWindow] order:aPlace window:aWindow relativeTo:otherWindow];
}
/* @ignore */
- (id)_dragHitTest:(CPPoint)aPoint pasteboard:(CPPasteboard)aPasteboard
{
return [window.firstWindow _dragHitTest:aPoint pasteboard:aPasteboard];
return [[CPPlatformWindow primaryPlatformWindow] _dragHitTest:aPoint pasteboard:aPasteboard];
}
/* @ignore */
- (void)_propagateCurrentDOMEvent:(BOOL)aFlag
{
return [window.firstWindow _propagateCurrentDOMEvent:aFlag];
return [[CPPlatformWindow primaryPlatformWindow] _propagateCurrentDOMEvent:aFlag];
}
- (CPWindow)hitTest:(CPPoint)location
{
return [window.firstWindow hitTest:location];
return [[CPPlatformWindow primaryPlatformWindow] hitTest:location];
}
@end