mirror of https://github.com/encounter/SDL.git
Fix icon of wayland message box
Also add some comments and silence a warning. Co-authored-by: Ethan Lee <flibitijibibo@gmail.com>
This commit is contained in:
parent
d0cf3b7555
commit
12dd412b0b
|
@ -25,9 +25,10 @@
|
||||||
|
|
||||||
#include "SDL.h"
|
#include "SDL.h"
|
||||||
#include <stdlib.h> /* fgets */
|
#include <stdlib.h> /* fgets */
|
||||||
#include <stdio.h>
|
#include <stdio.h> /* FILE, STDOUT_FILENO, fdopen, fclose */
|
||||||
#include <unistd.h>
|
#include <unistd.h> /* pid_t, pipe, fork, close, dup2, execvp, _exit, EXIT_FAILURE */
|
||||||
#include <sys/wait.h>
|
#include <sys/wait.h> /* waitpid, WIFEXITED, WEXITSTATUS */
|
||||||
|
#include <string.h> /* strerr */
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
|
||||||
#define MAX_BUTTONS 8 /* Maximum number of buttons supported */
|
#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";
|
argv[argc++] = "--icon-name";
|
||||||
switch (messageboxdata->flags) {
|
switch (messageboxdata->flags) {
|
||||||
case SDL_MESSAGEBOX_ERROR:
|
case SDL_MESSAGEBOX_ERROR:
|
||||||
argv[argc++] = "error";
|
argv[argc++] = "dialog-error";
|
||||||
break;
|
break;
|
||||||
case SDL_MESSAGEBOX_WARNING:
|
case SDL_MESSAGEBOX_WARNING:
|
||||||
argv[argc++] = "warning";
|
argv[argc++] = "dialog-warning";
|
||||||
break;
|
break;
|
||||||
case SDL_MESSAGEBOX_INFORMATION:
|
case SDL_MESSAGEBOX_INFORMATION:
|
||||||
default:
|
default:
|
||||||
argv[argc++] = "information";
|
argv[argc++] = "dialog-information";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -100,7 +101,7 @@ Wayland_ShowMessageBox(const SDL_MessageBoxData *messageboxdata, int *buttonid)
|
||||||
/* const casting argv is fine:
|
/* const casting argv is fine:
|
||||||
* https://pubs.opengroup.org/onlinepubs/9699919799/functions/fexecve.html -> rational
|
* https://pubs.opengroup.org/onlinepubs/9699919799/functions/fexecve.html -> rational
|
||||||
*/
|
*/
|
||||||
execvp("zenity", argv);
|
execvp("zenity", (char **)argv);
|
||||||
_exit(EXIT_FAILURE);
|
_exit(EXIT_FAILURE);
|
||||||
} else if (pid1 < 0) {
|
} else if (pid1 < 0) {
|
||||||
close(fd_pipe[0]);
|
close(fd_pipe[0]);
|
||||||
|
|
Loading…
Reference in New Issue