mirror of
https://github.com/labwc/labwc.git
synced 2025-11-04 13:30:07 -05:00
implement Kill action
this action sends SIGTERM to a client's process
This commit is contained in:
parent
39bea30cd5
commit
52738eedcf
1 changed files with 13 additions and 0 deletions
13
src/action.c
13
src/action.c
|
|
@ -37,6 +37,7 @@ enum action_type {
|
||||||
ACTION_TYPE_INVALID = 0,
|
ACTION_TYPE_INVALID = 0,
|
||||||
ACTION_TYPE_NONE,
|
ACTION_TYPE_NONE,
|
||||||
ACTION_TYPE_CLOSE,
|
ACTION_TYPE_CLOSE,
|
||||||
|
ACTION_TYPE_KILL,
|
||||||
ACTION_TYPE_DEBUG,
|
ACTION_TYPE_DEBUG,
|
||||||
ACTION_TYPE_EXECUTE,
|
ACTION_TYPE_EXECUTE,
|
||||||
ACTION_TYPE_EXIT,
|
ACTION_TYPE_EXIT,
|
||||||
|
|
@ -63,6 +64,7 @@ const char *action_names[] = {
|
||||||
"INVALID",
|
"INVALID",
|
||||||
"None",
|
"None",
|
||||||
"Close",
|
"Close",
|
||||||
|
"Kill",
|
||||||
"Debug",
|
"Debug",
|
||||||
"Execute",
|
"Execute",
|
||||||
"Exit",
|
"Exit",
|
||||||
|
|
@ -244,6 +246,17 @@ actions_run(struct view *activator, struct server *server,
|
||||||
view_close(view);
|
view_close(view);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
case ACTION_TYPE_KILL:
|
||||||
|
if (view && view->surface) {
|
||||||
|
/* Send SIGTERM to the process associated with the surface */
|
||||||
|
pid_t pid = -1;
|
||||||
|
struct wl_client *client = view->surface->resource->client;
|
||||||
|
wl_client_get_credentials(client, &pid, NULL, NULL);
|
||||||
|
if (pid != -1) {
|
||||||
|
kill(pid, SIGTERM);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
case ACTION_TYPE_DEBUG:
|
case ACTION_TYPE_DEBUG:
|
||||||
debug_dump_scene(server);
|
debug_dump_scene(server);
|
||||||
break;
|
break;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue