mirror of
https://github.com/swaywm/sway.git
synced 2024-12-28 16:06:37 +01:00
Add IPC policy to config
Also reduces enum abuse, cc @minus7
This commit is contained in:
parent
0a1b211e09
commit
e9e1a6a409
4 changed files with 8 additions and 6 deletions
|
@ -1,6 +1,8 @@
|
||||||
#ifndef _SWAY_IPC_H
|
#ifndef _SWAY_IPC_H
|
||||||
#define _SWAY_IPC_H
|
#define _SWAY_IPC_H
|
||||||
|
|
||||||
|
#define event_mask(ev) (1 << (ev & 0x7F))
|
||||||
|
|
||||||
enum ipc_command_type {
|
enum ipc_command_type {
|
||||||
IPC_COMMAND = 0,
|
IPC_COMMAND = 0,
|
||||||
IPC_GET_WORKSPACES = 1,
|
IPC_GET_WORKSPACES = 1,
|
||||||
|
|
|
@ -191,7 +191,7 @@ enum command_context {
|
||||||
|
|
||||||
struct command_policy {
|
struct command_policy {
|
||||||
char *command;
|
char *command;
|
||||||
enum command_context context;
|
uint32_t context;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum secure_feature {
|
enum secure_feature {
|
||||||
|
@ -206,7 +206,7 @@ enum secure_feature {
|
||||||
|
|
||||||
struct feature_policy {
|
struct feature_policy {
|
||||||
char *program;
|
char *program;
|
||||||
enum secure_feature features;
|
uint32_t features;
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -281,6 +281,7 @@ struct sway_config {
|
||||||
// Security
|
// Security
|
||||||
list_t *command_policies;
|
list_t *command_policies;
|
||||||
list_t *feature_policies;
|
list_t *feature_policies;
|
||||||
|
uint32_t ipc_policy;
|
||||||
};
|
};
|
||||||
|
|
||||||
void pid_workspace_add(struct pid_workspace *pw);
|
void pid_workspace_add(struct pid_workspace *pw);
|
||||||
|
|
|
@ -345,6 +345,7 @@ static void config_defaults(struct sway_config *config) {
|
||||||
// Security
|
// Security
|
||||||
config->command_policies = create_list();
|
config->command_policies = create_list();
|
||||||
config->feature_policies = create_list();
|
config->feature_policies = create_list();
|
||||||
|
config->ipc_policy = UINT32_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int compare_modifiers(const void *left, const void *right) {
|
static int compare_modifiers(const void *left, const void *right) {
|
||||||
|
|
|
@ -55,8 +55,6 @@ bool ipc_send_reply(struct ipc_client *client, const char *payload, uint32_t pay
|
||||||
void ipc_get_workspaces_callback(swayc_t *workspace, void *data);
|
void ipc_get_workspaces_callback(swayc_t *workspace, void *data);
|
||||||
void ipc_get_outputs_callback(swayc_t *container, void *data);
|
void ipc_get_outputs_callback(swayc_t *container, void *data);
|
||||||
|
|
||||||
#define event_mask(ev) (1 << (ev & 0x7F))
|
|
||||||
|
|
||||||
void ipc_init(void) {
|
void ipc_init(void) {
|
||||||
ipc_socket = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
|
ipc_socket = socket(AF_UNIX, SOCK_STREAM | SOCK_NONBLOCK | SOCK_CLOEXEC, 0);
|
||||||
if (ipc_socket == -1) {
|
if (ipc_socket == -1) {
|
||||||
|
|
Loading…
Reference in a new issue