From 03f8528315fa46c95991a34f3325d7b33ae5538c Mon Sep 17 00:00:00 2001
From: Edward Rudd <urkle@outoforder.cc>
Date: Sat, 02 May 2020 21:48:36 +0000
Subject: [PATCH] Update source to SDL2 2.0.12
---
source/src/video/winrt/SDL_winrtmessagebox.cpp | 18 ++++++++++++------
1 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/source/src/video/winrt/SDL_winrtmessagebox.cpp b/source/src/video/winrt/SDL_winrtmessagebox.cpp
index 3576a3f..44973f2 100644
--- a/source/src/video/winrt/SDL_winrtmessagebox.cpp
+++ b/source/src/video/winrt/SDL_winrtmessagebox.cpp
@@ -1,6 +1,6 @@
/*
Simple DirectMedia Layer
- Copyright (C) 1997-2018 Sam Lantinga <slouken@libsdl.org>
+ Copyright (C) 1997-2020 Sam Lantinga <slouken@libsdl.org>
This software is provided 'as-is', without any express or implied
warranty. In no event will the authors be held liable for any damages
@@ -75,13 +75,19 @@
MessageDialog ^ dialog = ref new MessageDialog(WINRT_UTF8ToPlatformString(messageboxdata->message));
dialog->Title = WINRT_UTF8ToPlatformString(messageboxdata->title);
for (int i = 0; i < messageboxdata->numbuttons; ++i) {
- UICommand ^ button = ref new UICommand(WINRT_UTF8ToPlatformString(messageboxdata->buttons[i].text));
- button->Id = safe_cast<IntPtr>(i);
+ const SDL_MessageBoxButtonData *sdlButton;
+ if (messageboxdata->flags & SDL_MESSAGEBOX_BUTTONS_RIGHT_TO_LEFT) {
+ sdlButton = &messageboxdata->buttons[messageboxdata->numbuttons - 1 - i];
+ } else {
+ sdlButton = &messageboxdata->buttons[i];
+ }
+ UICommand ^ button = ref new UICommand(WINRT_UTF8ToPlatformString(sdlButton->text));
+ button->Id = safe_cast<IntPtr>((int)(sdlButton - messageboxdata->buttons));
dialog->Commands->Append(button);
- if (messageboxdata->buttons[i].flags & SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT) {
+ if (sdlButton->flags & SDL_MESSAGEBOX_BUTTON_ESCAPEKEY_DEFAULT) {
dialog->CancelCommandIndex = i;
}
- if (messageboxdata->buttons[i].flags & SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT) {
+ if (sdlButton->flags & SDL_MESSAGEBOX_BUTTON_RETURNKEY_DEFAULT) {
dialog->DefaultCommandIndex = i;
}
}
@@ -98,7 +104,7 @@
return SDL_SetError("An unknown error occurred in displaying the WinRT MessageDialog");
}
if (buttonid) {
- IntPtr results = safe_cast<IntPtr>(operation->GetResults()->Id);
+ IntPtr results = safe_cast<IntPtr>((int)(operation->GetResults()->Id));
int clicked_index = results.ToInt32();
*buttonid = messageboxdata->buttons[clicked_index].buttonid;
}
--
Gitblit v1.9.3