summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar Drew DeVault <sir@cmpwn.com>2017-02-20 06:48:33 -0500
committerLibravatar Drew DeVault <sir@cmpwn.com>2017-02-20 06:48:33 -0500
commiteabfb6c5598d5b655b40d8677d97b58cce757ef5 (patch)
tree02075b877bb9a6751e492aa9c1cbe2d59491d3d1
parentEnforce new IPC policies (diff)
downloadsway-eabfb6c5598d5b655b40d8677d97b58cce757ef5.tar.gz
sway-eabfb6c5598d5b655b40d8677d97b58cce757ef5.tar.zst
sway-eabfb6c5598d5b655b40d8677d97b58cce757ef5.zip
Add * policies and fix bug
-rw-r--r--include/sway/config.h7
-rw-r--r--sway/commands.c2
-rw-r--r--sway/commands/ipc.c3
3 files changed, 11 insertions, 1 deletions
diff --git a/include/sway/config.h b/include/sway/config.h
index c3a916b1..ba49b9a0 100644
--- a/include/sway/config.h
+++ b/include/sway/config.h
@@ -224,7 +224,12 @@ enum ipc_feature {
224 IPC_FEATURE_EVENT_MODE = 1024, 224 IPC_FEATURE_EVENT_MODE = 1024,
225 IPC_FEATURE_EVENT_WINDOW = 2048, 225 IPC_FEATURE_EVENT_WINDOW = 2048,
226 IPC_FEATURE_EVENT_BINDING = 4096, 226 IPC_FEATURE_EVENT_BINDING = 4096,
227 IPC_FEATURE_EVENT_INPUT = 8192 227 IPC_FEATURE_EVENT_INPUT = 8192,
228
229 IPC_FEATURE_ALL_COMMANDS = 1 | 2 | 4 | 8 | 16 | 32 | 64 | 128,
230 IPC_FEATURE_ALL_EVENTS = 256 | 512 | 1024 | 2048 | 4096 | 8192,
231
232 IPC_FEATURE_ALL = IPC_FEATURE_ALL_COMMANDS | IPC_FEATURE_ALL_EVENTS,
228}; 233};
229 234
230struct ipc_policy { 235struct ipc_policy {
diff --git a/sway/commands.c b/sway/commands.c
index c15cb00a..068e8866 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -297,6 +297,7 @@ static struct cmd_handler bar_colors_handlers[] = {
297}; 297};
298 298
299static struct cmd_handler ipc_handlers[] = { 299static struct cmd_handler ipc_handlers[] = {
300 { "*", cmd_ipc_cmd },
300 { "bar-config", cmd_ipc_cmd }, 301 { "bar-config", cmd_ipc_cmd },
301 { "command", cmd_ipc_cmd }, 302 { "command", cmd_ipc_cmd },
302 { "events", cmd_ipc_events }, 303 { "events", cmd_ipc_events },
@@ -308,6 +309,7 @@ static struct cmd_handler ipc_handlers[] = {
308}; 309};
309 310
310static struct cmd_handler ipc_event_handlers[] = { 311static struct cmd_handler ipc_event_handlers[] = {
312 { "*", cmd_ipc_event_cmd },
311 { "binding", cmd_ipc_event_cmd }, 313 { "binding", cmd_ipc_event_cmd },
312 { "input", cmd_ipc_event_cmd }, 314 { "input", cmd_ipc_event_cmd },
313 { "mode", cmd_ipc_event_cmd }, 315 { "mode", cmd_ipc_event_cmd },
diff --git a/sway/commands/ipc.c b/sway/commands/ipc.c
index 6b29706e..d49aab64 100644
--- a/sway/commands/ipc.c
+++ b/sway/commands/ipc.c
@@ -32,6 +32,7 @@ struct cmd_results *cmd_ipc(int argc, char **argv) {
32 } 32 }
33 33
34 current_policy = alloc_ipc_policy(program); 34 current_policy = alloc_ipc_policy(program);
35 list_add(config->ipc_policies, current_policy);
35 36
36 return cmd_results_new(CMD_BLOCK_IPC, NULL, NULL); 37 return cmd_results_new(CMD_BLOCK_IPC, NULL, NULL);
37} 38}
@@ -74,6 +75,7 @@ struct cmd_results *cmd_ipc_cmd(int argc, char **argv) {
74 char *name; 75 char *name;
75 enum ipc_feature type; 76 enum ipc_feature type;
76 } types[] = { 77 } types[] = {
78 { "*", IPC_FEATURE_ALL_COMMANDS },
77 { "command", IPC_FEATURE_COMMAND }, 79 { "command", IPC_FEATURE_COMMAND },
78 { "workspaces", IPC_FEATURE_GET_WORKSPACES }, 80 { "workspaces", IPC_FEATURE_GET_WORKSPACES },
79 { "outputs", IPC_FEATURE_GET_OUTPUTS }, 81 { "outputs", IPC_FEATURE_GET_OUTPUTS },
@@ -123,6 +125,7 @@ struct cmd_results *cmd_ipc_event_cmd(int argc, char **argv) {
123 char *name; 125 char *name;
124 enum ipc_feature type; 126 enum ipc_feature type;
125 } types[] = { 127 } types[] = {
128 { "*", IPC_FEATURE_ALL_EVENTS },
126 { "workspace", IPC_FEATURE_EVENT_WORKSPACE }, 129 { "workspace", IPC_FEATURE_EVENT_WORKSPACE },
127 { "output", IPC_FEATURE_EVENT_OUTPUT }, 130 { "output", IPC_FEATURE_EVENT_OUTPUT },
128 { "mode", IPC_FEATURE_EVENT_MODE }, 131 { "mode", IPC_FEATURE_EVENT_MODE },