Launcher/Signal/Mouse: Set wmfs ANSI approved, use signal instead sigaction and fix mouse_resize tiny bug.

This commit is contained in:
martin 2009-06-20 01:20:41 +02:00
parent 62a7fcf33f
commit 3fc2571b92
4 changed files with 10 additions and 20 deletions

View File

@ -50,7 +50,7 @@ add_executable(wmfs ${wmfs_src})
set(VERSION "0.1rc4 (On The Run)") set(VERSION "0.1rc4 (On The Run)")
# FLAGS # FLAGS
set(CFLAGS "-g -Wall") set(CFLAGS "-g -Wall -ansi")
set(CMAKE_C_FLAGS ${CFLAGS}) set(CMAKE_C_FLAGS ${CFLAGS})
set(LDFLAGS "-L /usr/local/lib") set(LDFLAGS "-L /usr/local/lib")
set_target_properties(wmfs PROPERTIES LINK_FLAGS ${LDFLAGS}) set_target_properties(wmfs PROPERTIES LINK_FLAGS ${LDFLAGS})

View File

@ -32,7 +32,8 @@
#include "wmfs.h" #include "wmfs.h"
#include <dirent.h> #include <dirent.h>
#include <limits.h>
#define PATH_MAX 4095
void void
launcher_execute(Launcher launcher) launcher_execute(Launcher launcher)

View File

@ -242,7 +242,7 @@ mouse_resize(Client *c)
} }
else 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) geo.width = ((c->geo.width + (ocx - geo.x) < c->minw)
? c->minw && (geo.x = (c->geo.x + c->geo.width) - c->minw) ? c->minw && (geo.x = (c->geo.x + c->geo.width) - c->minw)
: c->geo.width + (ocx - geo.x)); : c->geo.width + (ocx - geo.x));

View File

@ -138,6 +138,7 @@ quit(void)
/* }}} */ /* }}} */
XSync(dpy, False); XSync(dpy, False);
XCloseDisplay(dpy);
return; return;
} }
@ -238,7 +239,6 @@ void
uicb_reload(uicb_t cmd) uicb_reload(uicb_t cmd)
{ {
quit(); quit();
XCloseDisplay(dpy);
for(; argv_global[0] && argv_global[0] == ' '; ++argv_global); for(; argv_global[0] && argv_global[0] == ' '; ++argv_global);
@ -326,16 +326,11 @@ set_statustext(char *str)
} }
/** Signal handle function /** Signal handle function
* \param signum Signal number
*/ */
void void
handle_signal(int signum) signal_handle(int sig)
{ {
if(signum == SIGTERM || signum == SIGINT) exiting = True;
{
quit();
exit(EXIT_FAILURE);
}
return; return;
} }
@ -349,7 +344,6 @@ int
main(int argc, char **argv) main(int argc, char **argv)
{ {
int i; int i;
struct sigaction sig;
argv_global = _strdup(argv[0]); argv_global = _strdup(argv[0]);
@ -411,12 +405,9 @@ main(int argc, char **argv)
exit(EXIT_FAILURE); exit(EXIT_FAILURE);
} }
/* Set signal handle */ /* Set signal handler */
sig.sa_handler = handle_signal; (void)signal(SIGTERM, &signal_handle);
sig.sa_flags = 0; (void)signal(SIGINT, &signal_handle);
memset(&sig.sa_mask, 0, sizeof(sigset_t));
sigaction(SIGTERM, &sig, NULL);
sigaction(SIGINT, &sig, NULL);
/* Check if an other WM is already running; set the error handler */ /* Check if an other WM is already running; set the error handler */
XSetErrorHandler(errorhandler); XSetErrorHandler(errorhandler);
@ -427,8 +418,6 @@ main(int argc, char **argv)
mainloop(); mainloop();
quit(); quit();
XCloseDisplay(dpy);
return 0; return 0;
} }