mirror of
https://gitlab.freedesktop.org/wayland/weston.git
synced 2026-04-19 19:30:40 +02:00
shell: Add keybinding to force-close (SIGKILL) inactive clients
This commit is contained in:
parent
61cfa66d6f
commit
92a57db6f2
1 changed files with 21 additions and 0 deletions
21
src/shell.c
21
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"
|
||||
|
|
@ -2574,6 +2575,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)
|
||||
{
|
||||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue