Remove an ifdef controlling dialog button order

This commit is contained in:
Henrik Rydgård 2023-12-05 14:17:14 +01:00
parent fc49c1029a
commit 676a4de4d7
4 changed files with 17 additions and 13 deletions

View File

@ -188,6 +188,8 @@ enum SystemProperty {
SYSPROP_SKIP_UI,
SYSPROP_USER_DOCUMENTS_DIR,
SYSPROP_OK_BUTTON_LEFT,
};
enum class SystemNotification {

View File

@ -393,10 +393,8 @@ void PopupScreen::TriggerFinish(DialogResult result) {
OnCompleted(result);
}
#if PPSSPP_PLATFORM(UWP)
// Inform UI that popup close to hide OSK (if visible)
System_NotifyUIState("popup_closed");
#endif
}
void PopupScreen::CreateViews() {
@ -433,17 +431,17 @@ void PopupScreen::CreateViews() {
Margins buttonMargins(5, 5);
// Adjust button order to the platform default.
#if defined(_WIN32)
defaultButton_ = buttonRow->Add(new Button(button1_, new LinearLayoutParams(1.0f, buttonMargins)));
defaultButton_->OnClick.Handle<UIScreen>(this, &UIScreen::OnOK);
if (!button2_.empty())
buttonRow->Add(new Button(button2_, new LinearLayoutParams(1.0f, buttonMargins)))->OnClick.Handle<UIScreen>(this, &UIScreen::OnCancel);
#else
if (!button2_.empty())
buttonRow->Add(new Button(button2_, new LinearLayoutParams(1.0f)))->OnClick.Handle<UIScreen>(this, &UIScreen::OnCancel);
defaultButton_ = buttonRow->Add(new Button(button1_, new LinearLayoutParams(1.0f)));
defaultButton_->OnClick.Handle<UIScreen>(this, &UIScreen::OnOK);
#endif
if (System_GetPropertyBool(SYSPROP_OK_BUTTON_LEFT)) {
defaultButton_ = buttonRow->Add(new Button(button1_, new LinearLayoutParams(1.0f, buttonMargins)));
defaultButton_->OnClick.Handle<UIScreen>(this, &UIScreen::OnOK);
if (!button2_.empty())
buttonRow->Add(new Button(button2_, new LinearLayoutParams(1.0f, buttonMargins)))->OnClick.Handle<UIScreen>(this, &UIScreen::OnCancel);
} else {
if (!button2_.empty())
buttonRow->Add(new Button(button2_, new LinearLayoutParams(1.0f)))->OnClick.Handle<UIScreen>(this, &UIScreen::OnCancel);
defaultButton_ = buttonRow->Add(new Button(button1_, new LinearLayoutParams(1.0f)));
defaultButton_->OnClick.Handle<UIScreen>(this, &UIScreen::OnOK);
}
box_->Add(buttonRow);
}

View File

@ -435,6 +435,8 @@ bool System_GetPropertyBool(SystemProperty prop) {
}
case SYSPROP_DEBUGGER_PRESENT:
return IsDebuggerPresent();
case SYSPROP_OK_BUTTON_LEFT:
return true;
default:
return false;
}

View File

@ -383,6 +383,8 @@ bool System_GetPropertyBool(SystemProperty prop) {
return !g_Config.bDisableHTTPS;
case SYSPROP_DEBUGGER_PRESENT:
return IsDebuggerPresent();
case SYSPROP_OK_BUTTON_LEFT:
return true;
default:
return false;
}