diff --git a/ChangeLog b/ChangeLog index a87419d08..91bfccf2a 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,18 @@ +2001-12-09 Willem Rein Oudshoorn + + * Source/NSWindow.m (GSPerformVoidDragSelector): rewritten to not + rely on category on NSObject + (GSPerformDragSelector): rewritten to not rely on category on + NSObject + ([NSWindow -sendEvent:]): fixed bug in handling of informal + draggingDestination protocol + + * Headers/AppKit/NSWindow.h (NSCoding>): added instance variable + _lastDragOperationMask + + * Source/GNUmakefile (libgnustep-gui_OBJC_FILES): Removed obsolete + NSObjectProtocols.m file + Tue Dec 11 00:08:38 2001 Nicola Pero * Source/NSCell.m ([-setStringValue:]): Use a NSDebugMLLog to warn diff --git a/Documentation/gsdoc/DefaultsSummary.gsdoc b/Documentation/gsdoc/DefaultsSummary.gsdoc index 7c1c016d6..1b0662e0b 100644 --- a/Documentation/gsdoc/DefaultsSummary.gsdoc +++ b/Documentation/gsdoc/DefaultsSummary.gsdoc @@ -204,7 +204,7 @@ GraphicCompositing

- A boolean value which defaults to NO. If set to + A boolean value which defaults to YES. If set to YES, then the application uses various tricks to get alpha colors to work when compositing images. This may slow down drawing of images, but it is generally diff --git a/Headers/gnustep/gui/NSWindow.h b/Headers/gnustep/gui/NSWindow.h index 332469988..1c60b7719 100644 --- a/Headers/gnustep/gui/NSWindow.h +++ b/Headers/gnustep/gui/NSWindow.h @@ -116,6 +116,7 @@ APPKIT_EXPORT NSSize NSTokenSize; id _delegate; id _fieldEditor; id _lastDragView; + int _lastDragOperationMask; int _windowNum; int _gstate; NSColor *_backgroundColor; diff --git a/Source/GNUmakefile b/Source/GNUmakefile index 5f56ade0c..6aab550d8 100644 --- a/Source/GNUmakefile +++ b/Source/GNUmakefile @@ -100,7 +100,6 @@ NSMenuItem.m \ NSMenuItemCell.m \ NSOpenPanel.m \ NSOutlineView.m \ -NSObjectProtocols.m \ NSPageLayout.m \ NSPanel.m \ NSParagraphStyle.m \ diff --git a/Source/NSObjectProtocols.m b/Source/NSObjectProtocols.m deleted file mode 100644 index bd3b93417..000000000 --- a/Source/NSObjectProtocols.m +++ /dev/null @@ -1,97 +0,0 @@ -/* - NSObjectProtocols.h - - Various informal protocols. - - Copyright (C) 1999 Free Software Foundation, Inc. - - Author: Adam Fedor - Date: Jul 1999 - - This file is part of the GNUstep GUI Library. - - This library is free software; you can redistribute it and/or - modify it under the terms of the GNU Library General Public - License as published by the Free Software Foundation; either - version 2 of the License, or (at your option) any later version. - - This library is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - Library General Public License for more details. - - You should have received a copy of the GNU Library General Public - License along with this library; if not, write to the Free - Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111 USA. -*/ - -#include - -@implementation NSObject (NSDraggingDestination) - -// -// Before the Image is Released -// -- (NSDragOperation) draggingEntered: (id )sender -{ - return NSDragOperationNone; -} - -- (NSDragOperation) draggingUpdated: (id )sender -{ - return NSDragOperationNone; -} - -- (void) draggingExited: (id )sender -{ -} - -// -// After the Image is Released -// -- (BOOL) prepareForDragOperation: (id )sender -{ - return NO; -} - -- (BOOL) performDragOperation: (id )sender -{ - return NO; -} - -- (void) concludeDragOperation: (id )sender -{ -} - -@end - -@implementation NSObject (NSDraggingSource) - -// -// Querying the Source -// -- (NSDragOperation) draggingSourceOperationMaskForLocal: (BOOL)isLocal -{ - return NSDragOperationNone; -} - -- (BOOL) ignoreModifierKeysWhileDragging -{ - return NO; -} - -// -// Informing the Source -// -- (void) draggedImage: (NSImage*)image - beganAt: (NSPoint)screenPoint -{ -} - -- (void) draggedImage: (NSImage*)image - endedAt: (NSPoint)screenPoint - deposited: (BOOL)didDeposit -{ -} - -@end diff --git a/Source/NSWindow.m b/Source/NSWindow.m index 3fc7ba081..ff81bf0f3 100644 --- a/Source/NSWindow.m +++ b/Source/NSWindow.m @@ -2742,17 +2742,41 @@ resetCursorRectsForView(NSView *theView) break; -#define GSPerformDragSelector(view, sel, info, action) \ - if (view == _contentView && _delegate) \ - action = (int)[_delegate performSelector: sel withObject: \ - info]; \ - else \ - action = (int)[view performSelector: sel withObject: info] -#define GSPerformVoidDragSelector(view, sel, info) \ - if (view == _contentView && _delegate) \ - [_delegate performSelector: sel withObject: info]; \ - else \ - [view performSelector: sel withObject: info] +#define GSPerformDragSelector(view, sel, info, action) \ + do { \ + id target; \ + if (view == _contentView && _delegate) \ + { \ + target = _delegate; \ + } \ + else \ + { \ + target= view; \ + } \ + \ + if ([target respondsToSelector: sel]) \ + { \ + action = (int)[target performSelector: sel withObject: info]; \ + } \ + } while (0) + +#define GSPerformVoidDragSelector(view, sel, info) \ + do { \ + id target; \ + if (view == _contentView && _delegate) \ + { \ + target = _delegate; \ + } \ + else \ + { \ + target= view; \ + } \ + \ + if ([target respondsToSelector: sel]) \ + { \ + [target performSelector: sel withObject: info]; \ + } \ + } while (0) case GSAppKitDraggingEnter: case GSAppKitDraggingUpdate: @@ -2766,27 +2790,39 @@ resetCursorRectsForView(NSView *theView) @selector(draggingExited:), dragInfo); } _f.accepts_drag = GSViewAcceptsDrag(v, dragInfo); - if (_lastDragView != v && _f.accepts_drag) - { - GSPerformDragSelector(v, @selector(draggingEntered:), - dragInfo, action); - } - else - { - GSPerformDragSelector(v, @selector(draggingUpdated:), - dragInfo, action); - } - e = [NSEvent otherEventWithType: NSAppKitDefined - location: [theEvent locationInWindow] - modifierFlags: 0 - timestamp: 0 - windowNumber: _windowNum - context: GSCurrentContext() - subtype: GSAppKitDraggingStatus - data1: [theEvent data1] - data2: action]; - [GSCurrentContext() _postExternalEvent: e]; - _lastDragView = v; + if (_f.accepts_drag) + { + if (_lastDragView != v) + { + action = NSDragOperationNone; + GSPerformDragSelector(v, @selector(draggingEntered:), + dragInfo, action); + } + else + { + action = _lastDragOperationMask; + GSPerformDragSelector(v, @selector(draggingUpdated:), + dragInfo, action); + } + } + else + { + action = NSDragOperationNone; + } + + e = [NSEvent otherEventWithType: NSAppKitDefined + location: [theEvent locationInWindow] + modifierFlags: 0 + timestamp: 0 + windowNumber: _windowNum + context: GSCurrentContext() + subtype: GSAppKitDraggingStatus + data1: [theEvent data1] + data2: action]; + + _lastDragOperationMask = action; + [GSCurrentContext() _postExternalEvent: e]; + _lastDragView = v; break; case GSAppKitDraggingStatus: @@ -2798,10 +2834,10 @@ resetCursorRectsForView(NSView *theView) dragInfo = [GSCurrentContext() _dragInfo]; if (_lastDragView && _f.accepts_drag) { - GSPerformDragSelector(_lastDragView, - @selector(draggingExited:), dragInfo, - action); + GSPerformVoidDragSelector(_lastDragView, + @selector(draggingExited:), dragInfo); } + _lastDragOperationMask = NSDragOperationNone; _lastDragView = nil; break; @@ -2809,11 +2845,14 @@ resetCursorRectsForView(NSView *theView) if (_lastDragView && _f.accepts_drag) { dragInfo = [GSCurrentContext() _dragInfo]; - GSPerformDragSelector(_lastDragView, + + action = NO; + GSPerformDragSelector(_lastDragView, @selector(prepareForDragOperation:), dragInfo, action); if (action) { + action = NO; GSPerformDragSelector(_lastDragView, @selector(performDragOperation:), dragInfo, action); @@ -2825,6 +2864,7 @@ resetCursorRectsForView(NSView *theView) dragInfo); } } + _lastDragOperationMask = NSDragOperationNone; _lastDragView = nil; e = [NSEvent otherEventWithType: NSAppKitDefined location: [theEvent locationInWindow] @@ -2839,6 +2879,7 @@ resetCursorRectsForView(NSView *theView) break; case GSAppKitDraggingFinished: + _lastDragOperationMask = NSDragOperationNone; _lastDragView = nil; NSDebugLLog(@"NSDragging", @"Internal: dropped GSAppKitDraggingFinished event");