# HG changeset patch # User bsmith@81767d24-ef19-dc11-ae90-00e081727c95 # Date 1622498349 0 # Node ID 4a5364fe65b7ddcd2e68cfcc9a2729eef34e9b96 # Parent 99fdcb7f2a2af63b6dea0493c12a5d0f4b502331 iOS: Add some code to include DWViewController in the UIResponder chain. Also add a function to display the responder chain... this is debug code but I want to have it in the repository for now, until I get the problem fixed. diff -r 99fdcb7f2a2a -r 4a5364fe65b7 ios/dw.m --- a/ios/dw.m Mon May 31 16:53:11 2021 +0000 +++ b/ios/dw.m Mon May 31 21:59:09 2021 +0000 @@ -269,6 +269,15 @@ CGContextRef _dw_draw_context(id image, bool antialias); typedef id (*DWIMP)(id, SEL, ...); +void _dw_display_responder_chain(id window) +{ + NSLog(@"=== Starting responder chain dump ===\n"); + do { + NSLog(@"%@\n", [window description]); + } while((window = [window nextResponder])); + NSLog(@"=== Responder chain dump complete ===\n"); +} + /* Internal function to queue a window redraw */ void _dw_redraw(id window, int skip) { @@ -1289,6 +1298,7 @@ -(BOOL)windowShouldClose:(id)sender; -(void)windowDidBecomeMain:(id)sender; -(void)menuHandler:(id)sender; +-(UIResponder *)nextResponder; @end @implementation DWView @@ -1339,10 +1349,12 @@ { [DWObj menuHandler:sender]; } +-(UIResponder *)nextResponder { return [[self window] rootViewController]; } @end @interface DWViewController : UIViewController -(void)viewWillLayoutSubviews; +-(UIResponder *)nextResponder; @end @@ -1403,6 +1415,7 @@ [view setFrame:frame]; [view windowResized:frame.size]; } +-(UIResponder *)nextResponder { return [[self viewIfLoaded] window]; } @end #define _DW_BUTTON_TYPE_NORMAL 0 @@ -2085,6 +2098,7 @@ if(window) { __block UIMenu *popupmenu = [[window popupMenu] menu]; + _dw_display_responder_chain(tableView); config = [UIContextMenuConfiguration configurationWithIdentifier:@"DWContextMenu" previewProvider:nil actionProvider:^(NSArray* suggestedAction){return popupmenu;}]; @@ -7942,10 +7956,10 @@ * title: The Window title. * flStyle: Style flags, see the PM reference. */ -DW_FUNCTION_DEFINITION(dw_window_new, HWND, DW_UNUSED(HWND hwndOwner), const char *title, DW_UNUSED(ULONG flStyle)) +DW_FUNCTION_DEFINITION(dw_window_new, HWND, DW_UNUSED(HWND hwndOwner), const char *title, ULONG flStyle) DW_FUNCTION_ADD_PARAM3(hwndOwner, title, flStyle) DW_FUNCTION_RETURN(dw_window_new, HWND) -DW_FUNCTION_RESTORE_PARAM3(DW_UNUSED(hwndOwner), HWND, title, char *, DW_UNUSED(flStyle), ULONG) +DW_FUNCTION_RESTORE_PARAM3(DW_UNUSED(hwndOwner), HWND, title, char *, flStyle, ULONG) { DW_FUNCTION_INIT; CGRect screenrect = [[UIScreen mainScreen] bounds]; @@ -7958,7 +7972,9 @@ [window addSubview:view]; [window setBackgroundColor:[UIColor systemBackgroundColor]]; - /* TODO: Handle style flags... if we can? There is no visible frame */ + /* Handle style flags... There is no visible frame... + * On iOS 13 and higher if a titlebar is requested create a navigation bar. + */ if(@available(iOS 13.0, *)) { NSString *nstitle = [NSString stringWithUTF8String:title]; [window setLargeContentTitle:nstitle];