From fb7e7253444fd54889469cce4a43018eeb681720 Mon Sep 17 00:00:00 2001 From: Wolfgang Lux Date: Wed, 12 May 2010 14:47:10 +0000 Subject: [PATCH] Fix a rather long standing incompatibility between GNUstep and Cocoa and make -initWithContentRect:styleMask:backing:defer: the designated initializer of NSWindow. git-svn-id: svn+ssh://svn.gna.org/svn/gnustep/libs/gui/trunk@30368 72102866-910b-0410-8b05-ffd578937521 --- ChangeLog | 6 ++++ Source/NSWindow.m | 82 +++++++++++++++++++++++++---------------------- 2 files changed, 49 insertions(+), 39 deletions(-) diff --git a/ChangeLog b/ChangeLog index 3830a8094..5abb36b48 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,9 @@ +2010-05-12 Wolfgang Lux + + * Source/NSWindow.m: Fix a rather long standing incompatibility + and make -initWithContentRect:styleMask:backing:defer: the + designated initializer of NSWindow. + 2010-05-12 Wolfgang Lux * Source/GSNibLoading.m (-nibInstantiateWithOwner:topLevelObjects:): diff --git a/Source/NSWindow.m b/Source/NSWindow.m index 2a6d107b1..46abb9c7f 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -931,7 +931,8 @@ many times. /**

Initializes the receiver with a content rect of contentRect, a style mask of styleMask, and a - backing store type of backingType. + backing store type of backingType. This is the designated + initializer.

The style mask values are NSTitledWindowMask, for a @@ -951,41 +952,6 @@ many times. styleMask: (unsigned int)aStyle backing: (NSBackingStoreType)bufferingType defer: (BOOL)flag -{ - return [self initWithContentRect: contentRect - styleMask: aStyle - backing: bufferingType - defer: flag - screen: nil]; -} - -/** -

Initializes the receiver with a content rect of - contentRect, a style mask of styleMask, a - backing store type of backingType and a boolean - flag. flag specifies whether the window - should be created now (NO), or when it is displayed - (YES). -

- -

The style mask values are NSTitledWindowMask, for a - window with a title, NSClosableWindowMask, for a window - with a close widget, NSMiniaturizableWindowMask, for a - window with a miniaturize widget, and - NSResizableWindowMask, for a window with a resizing - widget. These mask values can be OR'd in any combination. -

- -

Backing store values are NSBackingStoreBuffered, - NSBackingStoreRetained and - NSBackingStoreNonretained. -

-*/ -- (id) initWithContentRect: (NSRect)contentRect - styleMask: (unsigned int)aStyle - backing: (NSBackingStoreType)bufferingType - defer: (BOOL)flag - screen: (NSScreen*)aScreen { NSRect cframe; NSInterfaceStyle style = @@ -1011,9 +977,7 @@ many times. _attachedSheet = nil; _backingType = bufferingType; _styleMask = aStyle; - if (aScreen == nil) - aScreen = [NSScreen mainScreen]; - ASSIGN(_screen, aScreen); + ASSIGN(_screen, [NSScreen mainScreen]); _depthLimit = [_screen depth]; _frame = [NSWindow frameRectForContentRect: contentRect styleMask: aStyle]; @@ -1075,6 +1039,46 @@ many times. return self; } +/** +

Initializes the receiver with a content rect of + contentRect, a style mask of styleMask, a + backing store type of backingType and a boolean + flag. flag specifies whether the window + should be created now (NO), or when it is displayed + (YES). +

+ +

The style mask values are NSTitledWindowMask, for a + window with a title, NSClosableWindowMask, for a window + with a close widget, NSMiniaturizableWindowMask, for a + window with a miniaturize widget, and + NSResizableWindowMask, for a window with a resizing + widget. These mask values can be OR'd in any combination. +

+ +

Backing store values are NSBackingStoreBuffered, + NSBackingStoreRetained and + NSBackingStoreNonretained. +

+*/ +- (id) initWithContentRect: (NSRect)contentRect + styleMask: (unsigned int)aStyle + backing: (NSBackingStoreType)bufferingType + defer: (BOOL)flag + screen: (NSScreen*)aScreen +{ + self = [self initWithContentRect: contentRect + styleMask: aStyle + backing: bufferingType + defer: flag]; + if (self && aScreen != nil) + { + ASSIGN(_screen, aScreen); + _depthLimit = [_screen depth]; + } + return self; +} + - (id) initWithWindowRef: (void *)windowRef { NSRect contentRect;