summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sway/commands.h1
-rw-r--r--sway/commands.c1
-rw-r--r--sway/commands/create_output.c39
-rw-r--r--sway/config/input.c7
-rw-r--r--sway/meson.build1
-rw-r--r--swaybar/status_line.c2
6 files changed, 50 insertions, 1 deletions
diff --git a/include/sway/commands.h b/include/sway/commands.h
index e51b12fd..226cf932 100644
--- a/include/sway/commands.h
+++ b/include/sway/commands.h
@@ -103,6 +103,7 @@ sway_cmd cmd_client_urgent;
103sway_cmd cmd_client_placeholder; 103sway_cmd cmd_client_placeholder;
104sway_cmd cmd_client_background; 104sway_cmd cmd_client_background;
105sway_cmd cmd_commands; 105sway_cmd cmd_commands;
106sway_cmd cmd_create_output;
106sway_cmd cmd_debuglog; 107sway_cmd cmd_debuglog;
107sway_cmd cmd_default_border; 108sway_cmd cmd_default_border;
108sway_cmd cmd_default_floating_border; 109sway_cmd cmd_default_floating_border;
diff --git a/sway/commands.c b/sway/commands.c
index 41e1c653..27a88319 100644
--- a/sway/commands.c
+++ b/sway/commands.c
@@ -143,6 +143,7 @@ static struct cmd_handler config_handlers[] = {
143/* Runtime-only commands. Keep alphabetized */ 143/* Runtime-only commands. Keep alphabetized */
144static struct cmd_handler command_handlers[] = { 144static struct cmd_handler command_handlers[] = {
145 { "border", cmd_border }, 145 { "border", cmd_border },
146 { "create_output", cmd_create_output },
146 { "exit", cmd_exit }, 147 { "exit", cmd_exit },
147 { "floating", cmd_floating }, 148 { "floating", cmd_floating },
148 { "fullscreen", cmd_fullscreen }, 149 { "fullscreen", cmd_fullscreen },
diff --git a/sway/commands/create_output.c b/sway/commands/create_output.c
new file mode 100644
index 00000000..a852c2a0
--- /dev/null
+++ b/sway/commands/create_output.c
@@ -0,0 +1,39 @@
1#include <wlr/backend/multi.h>
2#include <wlr/backend/wayland.h>
3#include <wlr/backend/x11.h>
4#include "sway/commands.h"
5#include "sway/server.h"
6#include "log.h"
7
8static void create_output(struct wlr_backend *backend, void *data) {
9 bool *done = data;
10 if (*done) {
11 return;
12 }
13
14 if (wlr_backend_is_wl(backend)) {
15 wlr_wl_output_create(backend);
16 *done = true;
17 } else if (wlr_backend_is_x11(backend)) {
18 wlr_x11_output_create(backend);
19 *done = true;
20 }
21}
22
23/**
24 * This command is intended for developer use only.
25 */
26struct cmd_results *cmd_create_output(int argc, char **argv) {
27 sway_assert(wlr_backend_is_multi(server.backend),
28 "Expected a multi backend");
29
30 bool done = false;
31 wlr_multi_for_each_backend(server.backend, create_output, &done);
32
33 if (!done) {
34 return cmd_results_new(CMD_INVALID, "create_output",
35 "Can only create outputs for Wayland or X11 backends");
36 }
37
38 return cmd_results_new(CMD_SUCCESS, NULL, NULL);
39}
diff --git a/sway/config/input.c b/sway/config/input.c
index 9885e85c..ad5b96c8 100644
--- a/sway/config/input.c
+++ b/sway/config/input.c
@@ -140,6 +140,13 @@ void free_input_config(struct input_config *ic) {
140 return; 140 return;
141 } 141 }
142 free(ic->identifier); 142 free(ic->identifier);
143 free(ic->xkb_layout);
144 free(ic->xkb_model);
145 free(ic->xkb_options);
146 free(ic->xkb_rules);
147 free(ic->xkb_variant);
148 free(ic->mapped_from_region);
149 free(ic->mapped_to_output);
143 free(ic); 150 free(ic);
144} 151}
145 152
diff --git a/sway/meson.build b/sway/meson.build
index 01c83a33..d67a4c64 100644
--- a/sway/meson.build
+++ b/sway/meson.build
@@ -35,6 +35,7 @@ sway_sources = files(
35 'commands/bind.c', 35 'commands/bind.c',
36 'commands/border.c', 36 'commands/border.c',
37 'commands/client.c', 37 'commands/client.c',
38 'commands/create_output.c',
38 'commands/default_border.c', 39 'commands/default_border.c',
39 'commands/default_floating_border.c', 40 'commands/default_floating_border.c',
40 'commands/default_orientation.c', 41 'commands/default_orientation.c',
diff --git a/swaybar/status_line.c b/swaybar/status_line.c
index 01ed70d9..401bf6f6 100644
--- a/swaybar/status_line.c
+++ b/swaybar/status_line.c
@@ -147,8 +147,8 @@ void status_line_free(struct status_line *status) {
147 wl_list_remove(&block->link); 147 wl_list_remove(&block->link);
148 i3bar_block_unref(block); 148 i3bar_block_unref(block);
149 } 149 }
150 json_tokener_free(status->tokener);
150 } 151 }
151 json_tokener_free(status->tokener);
152 free(status->buffer); 152 free(status->buffer);
153 free(status); 153 free(status);
154} 154}