Mercurial > dwindows
comparison mac/dw.m @ 1862:9c7485b1921c
Fixed object/signal/memory leak on Mac when destroying
notebook and window objects... also some minor cleanup.
author | bsmith@81767d24-ef19-dc11-ae90-00e081727c95 |
---|---|
date | Tue, 05 Mar 2013 05:12:25 +0000 |
parents | c836603d3f14 |
children | 3f571ad9b92e |
comparison
equal
deleted
inserted
replaced
1861:c836603d3f14 | 1862:9c7485b1921c |
---|---|
817 -(void)mouseDragged:(NSEvent *)theEvent { _event_handler(self, theEvent, 5); } | 817 -(void)mouseDragged:(NSEvent *)theEvent { _event_handler(self, theEvent, 5); } |
818 -(int)redraw { return redraw; } | 818 -(int)redraw { return redraw; } |
819 -(void)setRedraw:(int)val { redraw = val; } | 819 -(void)setRedraw:(int)val { redraw = val; } |
820 -(int)shown { return shown; } | 820 -(int)shown { return shown; } |
821 -(void)setShown:(int)val { shown = val; } | 821 -(void)setShown:(int)val { shown = val; } |
822 -(void)dealloc { dw_signal_disconnect_by_window(self); [super dealloc]; } | |
822 @end | 823 @end |
823 | 824 |
824 /* Subclass for a render area type */ | 825 /* Subclass for a render area type */ |
825 @interface DWRender : NSControl | 826 @interface DWRender : NSControl |
826 { | 827 { |
910 { | 911 { |
911 if(_event_handler(sender, nil, 6) > 0) | 912 if(_event_handler(sender, nil, 6) > 0) |
912 return NO; | 913 return NO; |
913 return YES; | 914 return YES; |
914 } | 915 } |
915 - (void)viewDidMoveToWindow | 916 -(void)viewDidMoveToWindow |
916 { | 917 { |
917 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowResized:) name:NSWindowDidResizeNotification object:[self window]]; | 918 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowResized:) name:NSWindowDidResizeNotification object:[self window]]; |
918 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidBecomeMain:) name:NSWindowDidBecomeMainNotification object:[self window]]; | 919 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(windowDidBecomeMain:) name:NSWindowDidBecomeMainNotification object:[self window]]; |
919 } | 920 } |
920 - (void)dealloc | 921 -(void)dealloc |
921 { | 922 { |
922 if(windowmenu) | 923 if(windowmenu) |
923 { | 924 { |
924 [windowmenu release]; | 925 [windowmenu release]; |
925 } | 926 } |
926 [[NSNotificationCenter defaultCenter] removeObserver:self]; | 927 [[NSNotificationCenter defaultCenter] removeObserver:self]; |
927 dw_signal_disconnect_by_window(self); | 928 dw_signal_disconnect_by_window(self); |
928 [super dealloc]; | 929 [super dealloc]; |
929 } | 930 } |
930 - (void)windowResized:(NSNotification *)notification; | 931 -(void)windowResized:(NSNotification *)notification; |
931 { | 932 { |
932 NSSize size = [self frame].size; | 933 NSSize size = [self frame].size; |
933 | 934 |
934 if(oldsize.width != size.width || oldsize.height != size.height) | 935 if(oldsize.width != size.width || oldsize.height != size.height) |
935 { | 936 { |
8272 HWND tmpbox = dw_box_new(DW_VERT, 0); | 8273 HWND tmpbox = dw_box_new(DW_VERT, 0); |
8273 DWBox *box = tmpbox; | 8274 DWBox *box = tmpbox; |
8274 | 8275 |
8275 dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0); | 8276 dw_box_pack_start(tmpbox, page, 0, 0, TRUE, TRUE, 0); |
8276 [notepage setView:box]; | 8277 [notepage setView:box]; |
8278 [box autorelease]; | |
8277 } | 8279 } |
8278 } | 8280 } |
8279 | 8281 |
8280 #ifndef NSWindowCollectionBehaviorFullScreenPrimary | 8282 #ifndef NSWindowCollectionBehaviorFullScreenPrimary |
8281 #define NSWindowCollectionBehaviorFullScreenPrimary (1 << 7) | 8283 #define NSWindowCollectionBehaviorFullScreenPrimary (1 << 7) |