Skip to content

Commit

Permalink
Fixed bug 4747 - [Patch] SDL_ShowMessageBox ignores BUTTON_RETURNKEY_…
Browse files Browse the repository at this point in the history
…DEFAULT flag

Caleb Cornett

SDL_ShowMessageBox on UIKit doesn't do anything special with buttons that are marked with the flag SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT. According to Apple's documentation on UIAlertController, a button can respond to a return key if it's marked as the preferredAction of the controller. SDL doesn't set a preferredAction currently, so I've attached a patch to fix that.
  • Loading branch information
slouken committed Aug 6, 2019
1 parent e9ec7d4 commit 2a1adf7
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/video/uikit/SDL_uikitmessagebox.m
Expand Up @@ -91,6 +91,10 @@
clickedindex = (int)(sdlButton - messageboxdata->buttons);
}];
[alert addAction:action];

if (sdlButton->flags & SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT) {
alert.preferredAction = action;
}
}

if (messageboxdata->window) {
Expand Down

0 comments on commit 2a1adf7

Please sign in to comment.