1
0
mirror of https://github.com/gryf/wmaker.git synced 2026-01-08 14:54:13 +01:00

Add call to WMReleaseApplication on application exit

This commit is contained in:
David Maciejak
2014-04-06 01:52:51 +02:00
committed by Carlos R. Mafra
parent 588e04dda7
commit 01478146f9
3 changed files with 27 additions and 18 deletions

View File

@@ -84,6 +84,7 @@ static noreturn void quit(WMWidget *w, void *data)
prepareForClose(); prepareForClose();
WMReleaseApplication();
exit(0); exit(0);
} }

View File

@@ -292,6 +292,7 @@ static void closeWindow(WMWidget * w, void *d)
windowCount--; windowCount--;
if (windowCount == 0) { if (windowCount == 0) {
WMReleaseApplication();
exit(0); exit(0);
} else { } else {
WMDeleteTimerHandler(data->tid); WMDeleteTimerHandler(data->tid);

View File

@@ -100,6 +100,12 @@ typedef struct BackgroundTexture {
int height; int height;
} BackgroundTexture; } BackgroundTexture;
static void quit(int rcode)
{
WMReleaseApplication();
exit(rcode);
}
static void initXinerama(void) static void initXinerama(void)
{ {
xineInfo.screens = NULL; xineInfo.screens = NULL;
@@ -903,7 +909,7 @@ static noreturn void helperLoop(RContext * rc)
errcount--; errcount--;
if (errcount == 0) { if (errcount == 0) {
wfatal("quitting"); wfatal("quitting");
exit(1); quit(1);
} }
continue; continue;
} }
@@ -917,7 +923,7 @@ static noreturn void helperLoop(RContext * rc)
errcount--; errcount--;
if (errcount == 0) { if (errcount == 0) {
wfatal("quitting"); wfatal("quitting");
exit(1); quit(1);
} }
continue; continue;
} }
@@ -973,7 +979,7 @@ static noreturn void helperLoop(RContext * rc)
#ifdef DEBUG #ifdef DEBUG
printf("exit command\n"); printf("exit command\n");
#endif #endif
exit(0); quit(0);
default: default:
wwarning("unknown message received"); wwarning("unknown message received");
@@ -1228,7 +1234,7 @@ int main(int argc, char **argv)
i++; i++;
if (i >= argc) { if (i >= argc) {
wfatal("too few arguments for %s", argv[i - 1]); wfatal("too few arguments for %s", argv[i - 1]);
exit(1); quit(1);
} }
display = argv[i]; display = argv[i];
} else if (strcmp(argv[i], "-s") == 0 || strcmp(argv[i], "--scale") == 0) { } else if (strcmp(argv[i], "-s") == 0 || strcmp(argv[i], "--scale") == 0) {
@@ -1260,61 +1266,61 @@ int main(int argc, char **argv)
i++; i++;
if (i >= argc) { if (i >= argc) {
wfatal("too few arguments for %s", argv[i - 1]); wfatal("too few arguments for %s", argv[i - 1]);
exit(1); quit(1);
} }
domain = wstrdup(argv[i]); domain = wstrdup(argv[i]);
} else if (strcmp(argv[i], "-c") == 0 || strcmp(argv[i], "--colors") == 0) { } else if (strcmp(argv[i], "-c") == 0 || strcmp(argv[i], "--colors") == 0) {
i++; i++;
if (i >= argc) { if (i >= argc) {
wfatal("too few arguments for %s", argv[i - 1]); wfatal("too few arguments for %s", argv[i - 1]);
exit(1); quit(1);
} }
if (sscanf(argv[i], "%i", &cpc) != 1) { if (sscanf(argv[i], "%i", &cpc) != 1) {
wfatal("bad value for colors per channel: \"%s\"", argv[i]); wfatal("bad value for colors per channel: \"%s\"", argv[i]);
exit(1); quit(1);
} }
} else if (strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "--back-color") == 0) { } else if (strcmp(argv[i], "-b") == 0 || strcmp(argv[i], "--back-color") == 0) {
i++; i++;
if (i >= argc) { if (i >= argc) {
wfatal("too few arguments for %s", argv[i - 1]); wfatal("too few arguments for %s", argv[i - 1]);
exit(1); quit(1);
} }
back_color = argv[i]; back_color = argv[i];
} else if (strcmp(argv[i], "-p") == 0 || strcmp(argv[i], "--parse") == 0) { } else if (strcmp(argv[i], "-p") == 0 || strcmp(argv[i], "--parse") == 0) {
i++; i++;
if (i >= argc) { if (i >= argc) {
wfatal("too few arguments for %s", argv[i - 1]); wfatal("too few arguments for %s", argv[i - 1]);
exit(1); quit(1);
} }
texture = argv[i]; texture = argv[i];
} else if (strcmp(argv[i], "-w") == 0 || strcmp(argv[i], "--workspace") == 0) { } else if (strcmp(argv[i], "-w") == 0 || strcmp(argv[i], "--workspace") == 0) {
i++; i++;
if (i >= argc) { if (i >= argc) {
wfatal("too few arguments for %s", argv[i - 1]); wfatal("too few arguments for %s", argv[i - 1]);
exit(1); quit(1);
} }
if (sscanf(argv[i], "%i", &workspace) != 1) { if (sscanf(argv[i], "%i", &workspace) != 1) {
wfatal("bad value for workspace number: \"%s\"", argv[i]); wfatal("bad value for workspace number: \"%s\"", argv[i]);
exit(1); quit(1);
} }
} else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0) { } else if (strcmp(argv[i], "-v") == 0 || strcmp(argv[i], "--version") == 0) {
printf("%s (Window Maker %s)\n", __progname, VERSION); printf("%s (Window Maker %s)\n", __progname, VERSION);
exit(0); quit(0);
} else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) { } else if (strcmp(argv[i], "-h") == 0 || strcmp(argv[i], "--help") == 0) {
print_help(); print_help();
exit(0); quit(0);
} else if (argv[i][0] != '-') { } else if (argv[i][0] != '-') {
image_name = argv[i]; image_name = argv[i];
} else { } else {
printf("%s: invalid argument '%s'\n", __progname, argv[i]); printf("%s: invalid argument '%s'\n", __progname, argv[i]);
printf("Try '%s --help' for more information\n", __progname); printf("Try '%s --help' for more information\n", __progname);
exit(1); quit(1);
} }
} }
if (!image_name && !texture && !helperMode) { if (!image_name && !texture && !helperMode) {
printf("%s: you must specify a image file name or a texture\n", __progname); printf("%s: you must specify a image file name or a texture\n", __progname);
printf("Try '%s --help' for more information\n", __progname); printf("Try '%s --help' for more information\n", __progname);
exit(1); quit(1);
} }
PixmapPath = getPixmapPath(domain); PixmapPath = getPixmapPath(domain);
@@ -1334,7 +1340,7 @@ int main(int argc, char **argv)
dpy = XOpenDisplay(display); dpy = XOpenDisplay(display);
if (!dpy) { if (!dpy) {
wfatal("could not open display"); wfatal("could not open display");
exit(1); quit(1);
} }
#if 0 #if 0
XSynchronize(dpy, 1); XSynchronize(dpy, 1);
@@ -1367,7 +1373,7 @@ int main(int argc, char **argv)
if (!rc) { if (!rc) {
wfatal("could not initialize wrlib: %s", RMessageForError(RErrorCode)); wfatal("could not initialize wrlib: %s", RMessageForError(RErrorCode));
exit(1); quit(1);
} }
if (helperMode) { if (helperMode) {
@@ -1393,7 +1399,7 @@ int main(int argc, char **argv)
tex = parseTexture(rc, texture); tex = parseTexture(rc, texture);
if (!tex) if (!tex)
exit(1); quit(1);
if (workspace < 0) if (workspace < 0)
changeTexture(tex); changeTexture(tex);
@@ -1403,5 +1409,6 @@ int main(int argc, char **argv)
} }
} }
WMReleaseApplication();
return 0; return 0;
} }