diff --git a/cmd/wmii/client.c b/cmd/wmii/client.c index 42cbd4e4..b105d04f 100644 --- a/cmd/wmii/client.c +++ b/cmd/wmii/client.c @@ -5,6 +5,7 @@ #include "dat.h" #include #include +#include #include #include "fns.h" @@ -628,10 +629,25 @@ client_message(Client *c, char *msg, long l2) { void client_kill(Client *c, bool nice) { - if(nice && (c->proto & ProtoDelete)) { + char **host; + ulong *pid; + long n; + + if(!nice) { + getprop_textlist(&c->w, "WM_CLIENT_MACHINE", &host); + n = getprop_ulong(&c->w, Net("WM_PID"), "CARDINAL", 0, &pid, 1); + if(n && *host && !strcmp(hostname, *host)) + kill((uint)*pid, SIGKILL); + freestringlist(host); + free(pid); + + XKillClient(display, c->w.xid); + } + else if(c->proto & ProtoDelete) { client_message(c, "WM_DELETE_WINDOW", 0); ewmh_pingclient(c); - }else + } + else XKillClient(display, c->w.xid); } diff --git a/cmd/wmii/dat.h b/cmd/wmii/dat.h index 5027ccdd..9f312c3e 100644 --- a/cmd/wmii/dat.h +++ b/cmd/wmii/dat.h @@ -11,6 +11,8 @@ #include #include #include +#include +#include #include #include #include @@ -316,13 +318,13 @@ EXTERN struct { bool sel; } disp; -EXTERN Client* client; -EXTERN View* view; -EXTERN View* selview; -EXTERN Key* key; -EXTERN Divide* divs; EXTERN Client c_magic; EXTERN Client c_root; +EXTERN Client* client; +EXTERN Divide* divs; +EXTERN Key* key; +EXTERN View* selview; +EXTERN View* view; EXTERN Handlers framehandler; @@ -331,17 +333,18 @@ EXTERN IxpServer srv; EXTERN Ixp9Srv p9srv; /* X11 */ -EXTERN uint valid_mask; -EXTERN uint numlock_mask; -EXTERN Image* ibuf; EXTERN Image* ibuf32; +EXTERN Image* ibuf; +EXTERN uint numlock_mask; +EXTERN uint valid_mask; /* Misc */ -EXTERN int starting; -EXTERN bool resizing; -EXTERN long ignoreenter; -EXTERN char* user; EXTERN char* execstr; +EXTERN char hostname[HOST_NAME_MAX + 1]; +EXTERN long ignoreenter; +EXTERN bool resizing; +EXTERN int starting; +EXTERN char* user; EXTERN long xtime; EXTERN Client* kludge; diff --git a/cmd/wmii/fs.c b/cmd/wmii/fs.c index 89502dee..ad7a5b29 100644 --- a/cmd/wmii/fs.c +++ b/cmd/wmii/fs.c @@ -5,7 +5,6 @@ #include #include #include -#include #include "fns.h" typedef union IxpFileIdU IxpFileIdU; diff --git a/cmd/wmii/main.c b/cmd/wmii/main.c index 3761199c..8b2eab48 100644 --- a/cmd/wmii/main.c +++ b/cmd/wmii/main.c @@ -12,7 +12,6 @@ #include #include #include -#include #include "fns.h" static const char @@ -382,6 +381,7 @@ extern int fmtevent(Fmt*); passwd = getpwuid(getuid()); user = estrdup(passwd->pw_name); + gethostname(hostname, sizeof(hostname) - 1); init_environment();