swayfx/sway/commands/create_output.c
M Stoeckl 2a684cad5f Remove now-unused "input" argument of cmd_results_new
Patch tested by compiling with `__attribute__ ((format (printf, 2, 3)))`
applied to `cmd_results_new`.

String usage constants have been converted from pointers to arrays when
encountered. General handler format strings were sometimes modified to
include the old input string, especially for unknown command errors.
2019-01-14 08:05:29 -05:00

46 lines
1,007 B
C

#include <wlr/config.h>
#include <wlr/backend/multi.h>
#include <wlr/backend/wayland.h>
#if WLR_HAS_X11_BACKEND
#include <wlr/backend/x11.h>
#endif
#include "sway/commands.h"
#include "sway/server.h"
#include "log.h"
static void create_output(struct wlr_backend *backend, void *data) {
bool *done = data;
if (*done) {
return;
}
if (wlr_backend_is_wl(backend)) {
wlr_wl_output_create(backend);
*done = true;
}
#if WLR_HAS_X11_BACKEND
else if (wlr_backend_is_x11(backend)) {
wlr_x11_output_create(backend);
*done = true;
}
#endif
}
/**
* This command is intended for developer use only.
*/
struct cmd_results *cmd_create_output(int argc, char **argv) {
sway_assert(wlr_backend_is_multi(server.backend),
"Expected a multi backend");
bool done = false;
wlr_multi_for_each_backend(server.backend, create_output, &done);
if (!done) {
return cmd_results_new(CMD_INVALID,
"Can only create outputs for Wayland or X11 backends");
}
return cmd_results_new(CMD_SUCCESS, NULL);
}