diff --git a/src/LScreens.c b/src/LScreens.c index 59a5c1180..d9f2122dc 100644 --- a/src/LScreens.c +++ b/src/LScreens.c @@ -1239,6 +1239,7 @@ static void ServersScreen_Init(struct LScreen* s_) { s->btnConnect.OnClick = ServersScreen_Connect; s->btnRefresh.OnClick = ServersScreen_Refresh; + s->iptSearch.skipsEnter = true; s->iptSearch.TextChanged = ServersScreen_SearchChanged; s->iptHash.TextChanged = ServersScreen_HashChanged; s->iptHash.ClipboardFilter = ServersScreen_HashFilter; diff --git a/src/LWidgets.h b/src/LWidgets.h index ad6d23494..a679dc776 100644 --- a/src/LWidgets.h +++ b/src/LWidgets.h @@ -50,6 +50,7 @@ struct LWidgetVTABLE { cc_bool dirty; /* Whether this widget needs to be redrawn */ \ cc_bool opaque; /* Whether this widget completely obscures background behind it */ \ cc_uint8 type; /* Type of this widget */ \ + cc_bool skipsEnter; /* Whether clicking this widget DOESN'T trigger OnEnterWidget */ \ void (*OnClick)(void* widget); /* Called when widget is clicked */ \ void (*OnHover)(void* widget); /* Called when widget is hovered over */ \ void (*OnUnhover)(void* widget);/*Called when widget is no longer hovered over */ \ diff --git a/src/interop_ios.m b/src/interop_ios.m index f131f020d..c8779c6f1 100644 --- a/src/interop_ios.m +++ b/src/interop_ios.m @@ -686,7 +686,8 @@ static NSString* cellID = @"CC_Cell"; } - (NSInteger)tableView:(nonnull UITableView *)tableView numberOfRowsInSection:(NSInteger)section { - return FetchServersTask.numServers; + struct LTable* w = (struct LTable*)FindWidgetForView(tableView); + return w ? w->rowsCount : 0; } // === UITableViewDelegate === @@ -708,10 +709,12 @@ static NSString* cellID = @"CC_Cell"; // === UITextFieldDelegate === - (BOOL)textFieldShouldReturn:(UITextField *)textField { - struct LWidget* w = Launcher_Active->onEnterWidget; + struct LWidget* w = FindWidgetForView(textField); + if (w == NULL) return YES; + struct LWidget* sel = Launcher_Active->onEnterWidget; - if (w) { - w->OnClick(w); + if (sel && !w->skipsEnter) { + sel->OnClick(sel); } else { [textField resignFirstResponder]; }