diff --git a/CMakeLists.txt b/CMakeLists.txt index cfcc7f8..a125157 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -50,7 +50,7 @@ add_executable(wmfs ${wmfs_src}) set(VERSION "0.1rc4 (On The Run)") # FLAGS -set(CFLAGS "-g -Wall") +set(CFLAGS "-g -Wall -ansi") set(CMAKE_C_FLAGS ${CFLAGS}) set(LDFLAGS "-L /usr/local/lib") set_target_properties(wmfs PROPERTIES LINK_FLAGS ${LDFLAGS}) diff --git a/src/launcher.c b/src/launcher.c index e6db02c..aea4c51 100644 --- a/src/launcher.c +++ b/src/launcher.c @@ -32,7 +32,8 @@ #include "wmfs.h" #include -#include + +#define PATH_MAX 4095 void launcher_execute(Launcher launcher) diff --git a/src/mouse.c b/src/mouse.c index 0edd9bb..d1a2a0d 100644 --- a/src/mouse.c +++ b/src/mouse.c @@ -242,7 +242,7 @@ mouse_resize(Client *c) } else { - geo.x = ocx - (ocx - ev.xmotion.x); + geo.x = (geo.width != c->maxw) ? ocx - (ocx - ev.xmotion.x) : geo.x; geo.width = ((c->geo.width + (ocx - geo.x) < c->minw) ? c->minw && (geo.x = (c->geo.x + c->geo.width) - c->minw) : c->geo.width + (ocx - geo.x)); diff --git a/src/wmfs.c b/src/wmfs.c index 8889134..cda885e 100644 --- a/src/wmfs.c +++ b/src/wmfs.c @@ -138,6 +138,7 @@ quit(void) /* }}} */ XSync(dpy, False); + XCloseDisplay(dpy); return; } @@ -238,7 +239,6 @@ void uicb_reload(uicb_t cmd) { quit(); - XCloseDisplay(dpy); for(; argv_global[0] && argv_global[0] == ' '; ++argv_global); @@ -326,16 +326,11 @@ set_statustext(char *str) } /** Signal handle function - * \param signum Signal number */ void -handle_signal(int signum) +signal_handle(int sig) { - if(signum == SIGTERM || signum == SIGINT) - { - quit(); - exit(EXIT_FAILURE); - } + exiting = True; return; } @@ -349,7 +344,6 @@ int main(int argc, char **argv) { int i; - struct sigaction sig; argv_global = _strdup(argv[0]); @@ -411,12 +405,9 @@ main(int argc, char **argv) exit(EXIT_FAILURE); } - /* Set signal handle */ - sig.sa_handler = handle_signal; - sig.sa_flags = 0; - memset(&sig.sa_mask, 0, sizeof(sigset_t)); - sigaction(SIGTERM, &sig, NULL); - sigaction(SIGINT, &sig, NULL); + /* Set signal handler */ + (void)signal(SIGTERM, &signal_handle); + (void)signal(SIGINT, &signal_handle); /* Check if an other WM is already running; set the error handler */ XSetErrorHandler(errorhandler); @@ -427,8 +418,6 @@ main(int argc, char **argv) mainloop(); quit(); - XCloseDisplay(dpy); - return 0; }