From 12dd412b0b250119985729c700e09c4aaba06703 Mon Sep 17 00:00:00 2001
From: Mathieu Eyraud <[EMAIL REDACTED]>
Date: Wed, 21 Apr 2021 13:31:15 +0200
Subject: [PATCH] Fix icon of wayland message box
Also add some comments and silence a warning.
Co-authored-by: Ethan Lee <flibitijibibo@gmail.com>
---
src/video/wayland/SDL_waylandmessagebox.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/src/video/wayland/SDL_waylandmessagebox.c b/src/video/wayland/SDL_waylandmessagebox.c
index d944833b3..7b42edf35 100644
--- a/src/video/wayland/SDL_waylandmessagebox.c
+++ b/src/video/wayland/SDL_waylandmessagebox.c
@@ -25,9 +25,10 @@
#include "SDL.h"
#include <stdlib.h> /* fgets */
-#include <stdio.h>
-#include <unistd.h>
-#include <sys/wait.h>
+#include <stdio.h> /* FILE, STDOUT_FILENO, fdopen, fclose */
+#include <unistd.h> /* pid_t, pipe, fork, close, dup2, execvp, _exit, EXIT_FAILURE */
+#include <sys/wait.h> /* waitpid, WIFEXITED, WEXITSTATUS */
+#include <string.h> /* strerr */
#include <errno.h>
#define MAX_BUTTONS 8 /* Maximum number of buttons supported */
@@ -62,14 +63,14 @@ Wayland_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
argv[argc++] = "--icon-name";
switch (messageboxdata->flags) {
case SDL_MESSAGEBOX_ERROR:
- argv[argc++] = "error";
+ argv[argc++] = "dialog-error";
break;
case SDL_MESSAGEBOX_WARNING:
- argv[argc++] = "warning";
+ argv[argc++] = "dialog-warning";
break;
case SDL_MESSAGEBOX_INFORMATION:
default:
- argv[argc++] = "information";
+ argv[argc++] = "dialog-information";
break;
}
@@ -100,7 +101,7 @@ Wayland_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
/* const casting argv is fine:
* https://pubs.opengroup.org/onlinepubs/9699919799/functions/fexecve.html -> rational
*/
- execvp("zenity", argv);
+ execvp("zenity", (char **)argv);
_exit(EXIT_FAILURE);
} else if (pid1 < 0) {
close(fd_pipe[0]);