diff --git a/macosx/DragOverlayWindow.m b/macosx/DragOverlayWindow.m index 3f3a0e263..3eeb94e6b 100644 --- a/macosx/DragOverlayWindow.m +++ b/macosx/DragOverlayWindow.m @@ -26,11 +26,17 @@ #import "DragOverlayView.h" #import "NSStringAdditions.h" +@interface DragOverlayWindow (Private) + +- (void) resizeWindow; + +@end + @implementation DragOverlayWindow - (id) initWithLib: (tr_session *) lib forWindow: (NSWindow *) window { - if ((self = ([super initWithContentRect: NSMakeRect(0, 0, 1.0, 1.0) styleMask: NSBorderlessWindowMask + if ((self = ([super initWithContentRect: NSZeroRect styleMask: NSBorderlessWindowMask backing: NSBackingStoreBuffered defer: NO]))) { fLib = lib; @@ -60,12 +66,18 @@ [fFadeOutAnimation setAnimationBlockingMode: NSAnimationNonblockingThreaded]; [window addChildWindow: self ordered: NSWindowAbove]; + [self setFrame: [window frame] display: NO]; + + [[NSNotificationCenter defaultCenter] addObserver: self selector: @selector(resizeWindow) + name: NSWindowDidResizeNotification object: window]; } return self; } - (void) dealloc { + [[NSNotificationCenter defaultCenter] removeObserver: self]; + [fFadeInAnimation release]; [fFadeOutAnimation release]; @@ -175,3 +187,12 @@ } @end + +@implementation DragOverlayWindow (Private) + +- (void) resizeWindow +{ + [self setFrame: [[self parentWindow] frame] display: NO]; +} + +@end