Change global UI messages to use an enum instead of strings.

Makes it easier to add new ones and delete outdated ones without missing
any uses.
This commit is contained in:
Henrik Rydgård committed 2023-09-30 11:37:02 +02:00
1 parent 526d3047c7
commit 19e4de5088
37 files changed
+217 -195

No files matched your search

+8 -8
View File
@@ -241,7 +241,7 @@ namespace MainWindow
g_Config.iInternalResolution = 0;
}
System_PostUIMessage("gpu_renderResized", "");
System_PostUIMessage(UIMessage::GPU_RENDER_RESIZED);
}
void CorrectCursor() {
@@ -282,7 +282,7 @@ namespace MainWindow
SavePosition();
Core_NotifyWindowHidden(false);
if (!g_Config.bPauseWhenMinimized) {
System_PostUIMessage("window minimized", "false");
System_PostUIMessage(UIMessage::WINDOW_MINIMIZED, "false");
}
int width, height;
@@ -302,8 +302,8 @@ namespace MainWindow
DEBUG_LOG(SYSTEM, "Pixel width/height: %dx%d", PSP_CoreParameter().pixelWidth, PSP_CoreParameter().pixelHeight);
if (UpdateScreenScale(width, height)) {
System_PostUIMessage("gpu_displayResized", "");
System_PostUIMessage("gpu_renderResized", "");
System_PostUIMessage(UIMessage::GPU_DISPLAY_RESIZED);
System_PostUIMessage(UIMessage::GPU_RENDER_RESIZED);
}
// Don't save the window state if fullscreen.
@@ -853,12 +853,12 @@ namespace MainWindow
}
if (wParam == WA_ACTIVE || wParam == WA_CLICKACTIVE) {
System_PostUIMessage("got_focus", "");
System_PostUIMessage(UIMessage::GOT_FOCUS);
hasFocus = true;
trapMouse = true;
}
if (wParam == WA_INACTIVE) {
System_PostUIMessage("lost_focus", "");
System_PostUIMessage(UIMessage::LOST_FOCUS);
WindowsRawInput::LoseFocus();
InputDevice::LoseFocus();
hasFocus = false;
@@ -905,7 +905,7 @@ namespace MainWindow
case SIZE_MINIMIZED:
Core_NotifyWindowHidden(true);
if (!g_Config.bPauseWhenMinimized) {
System_PostUIMessage("window minimized", "true");
System_PostUIMessage(UIMessage::WINDOW_MINIMIZED, "true");
}
InputDevice::LoseFocus();
break;
@@ -1029,7 +1029,7 @@ namespace MainWindow
TCHAR filename[512];
if (DragQueryFile(hdrop, 0, filename, 512) != 0) {
const std::string utf8_filename = ReplaceAll(ConvertWStringToUTF8(filename), "\\", "/");
System_PostUIMessage("boot", utf8_filename);
System_PostUIMessage(UIMessage::REQUEST_GAME_BOOT, utf8_filename);
Core_EnableStepping(false);
}
}