# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1639855917 0 # Node ID 02c53dd5e21db4d9b06064570ac40d696aa9e0ec # Parent c2387166a41430cf940503fef40d054ab6a1d480 iOS: I used to save the user data on the DWView subview of a DWWindow... Not sure what my thinking on that was, but sometimes it isn't possible to get the DWView from the subviews... so make it so DWWindow can store userdata as well in those cases. May want to just remove the code to save the data on the DWView altogether, but will have to evaluate why I did that in the first place. diff -r c2387166a414 -r 02c53dd5e21d ios/dw.m --- a/ios/dw.m Fri Dec 17 12:47:28 2021 +0000 +++ b/ios/dw.m Sat Dec 18 19:31:57 2021 +0000 @@ -797,6 +797,7 @@ DWMenu *windowmenu, *popupmenu; int redraw; int shown; + void *userdata; } -(void)sendEvent:(UIEvent *)theEvent; -(void)keyDown:(UIKey *)key API_AVAILABLE(ios(13.4)); @@ -809,6 +810,8 @@ -(void)setPopupMenu:(DWMenu *)input; -(DWMenu *)menu; -(DWMenu *)popupMenu; +-(void *)userdata; +-(void)setUserdata:(void *)input; @end @implementation DWWindow @@ -839,6 +842,8 @@ } -(void)dealloc { + UserData *root = userdata; + _dw_remove_userdata(&root, NULL, TRUE); if(windowmenu) [windowmenu release]; if(popupmenu) @@ -846,6 +851,8 @@ dw_signal_disconnect_by_window(self); [super dealloc]; } +-(void *)userdata { return userdata; } +-(void)setUserdata:(void *)input { userdata = input; } @end @interface DWImage : NSObject @@ -9581,7 +9588,14 @@ { UIWindow *win = window; NSArray *subviews = [win subviews]; - object = [subviews firstObject]; + for(id obj in subviews) + { + if([obj isMemberOfClass:[DWView class]]) + { + object = obj; + break; + } + } } else if([object isMemberOfClass:[UIScrollView class]]) { @@ -9631,7 +9645,14 @@ { UIWindow *win = window; NSArray *subviews = [win subviews]; - object = [subviews firstObject]; + for(id obj in subviews) + { + if([obj isMemberOfClass:[DWView class]]) + { + object = obj; + break; + } + } } else if([object isMemberOfClass:[UIScrollView class]]) {