diff options
author | Kristian Høgsberg <krh@bitplanet.net> | 2012-05-26 13:41:06 -0400 |
---|---|---|
committer | Kristian Høgsberg <krh@bitplanet.net> | 2012-05-26 13:41:06 -0400 |
commit | 92a57db6f2fb54d70e5da00aaabc6af752ee07a2 (patch) | |
tree | 03520640a25ac47147e44ea71c67821677ade385 | |
parent | 61cfa66d6f5780f0d6c5e9f7091ea5919d247531 (diff) |
shell: Add keybinding to force-close (SIGKILL) inactive clients
-rw-r--r-- | src/shell.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/shell.c b/src/shell.c index b37de80..e1f3a04 100644 --- a/src/shell.c +++ b/src/shell.c @@ -30,6 +30,7 @@ #include <assert.h> #include <signal.h> #include <math.h> +#include <sys/types.h> #include <wayland-server.h> #include "compositor.h" @@ -2575,6 +2576,24 @@ debug_repaint_binding(struct wl_seat *seat, uint32_t time, } static void +force_kill_binding(struct wl_seat *seat, uint32_t time, + uint32_t key, uint32_t button, uint32_t axis, + int32_t value, void *data) +{ + struct wl_client *client; + pid_t pid; + uid_t uid; + gid_t gid; + + if (value == 1) { + client = seat->keyboard->focus->resource.client; + wl_client_get_credentials(client, &pid, &uid, &gid); + + kill(pid, SIGKILL); + } +} + +static void shell_destroy(struct wl_listener *listener, void *data) { struct desktop_shell *shell = @@ -2633,6 +2652,8 @@ shell_add_bindings(struct weston_compositor *ec, struct desktop_shell *shell) backlight_binding, ec); weston_compositor_add_binding(ec, KEY_SPACE, 0, 0, mod, debug_repaint_binding, shell); + weston_compositor_add_binding(ec, KEY_K, 0, 0, mod, + force_kill_binding, shell); } int |