update for latest wlroots

This commit is contained in:
Tony Crisci 2018-02-24 21:13:46 -05:00
parent 9a50972577
commit 2ea9a55d96
2 changed files with 24 additions and 21 deletions

View file

@ -46,25 +46,25 @@ static struct cmd_results *backend_cmd_add(int argc, char **argv) {
static struct cmd_results *backend_cmd_add_output(int argc, char **argv, static struct cmd_results *backend_cmd_add_output(int argc, char **argv,
struct sway_subbackend *backend) { struct sway_subbackend *backend) {
sway_log(L_DEBUG, "TODO: backend cmd add_output"); wlr_log(L_DEBUG, "TODO: backend cmd add_output");
return NULL; return NULL;
} }
static struct cmd_results *backend_cmd_del_output(int argc, char **argv, static struct cmd_results *backend_cmd_del_output(int argc, char **argv,
struct sway_subbackend *backend) { struct sway_subbackend *backend) {
sway_log(L_DEBUG, "TODO: backend cmd del_output"); wlr_log(L_DEBUG, "TODO: backend cmd del_output");
return NULL; return NULL;
} }
static struct cmd_results *backend_cmd_add_input(int argc, char **argv, static struct cmd_results *backend_cmd_add_input(int argc, char **argv,
struct sway_subbackend *backend) { struct sway_subbackend *backend) {
sway_log(L_DEBUG, "TODO: backend cmd add_input"); wlr_log(L_DEBUG, "TODO: backend cmd add_input");
return NULL; return NULL;
} }
static struct cmd_results *backend_cmd_del_input(int argc, char **argv, static struct cmd_results *backend_cmd_del_input(int argc, char **argv,
struct sway_subbackend *backend) { struct sway_subbackend *backend) {
sway_log(L_DEBUG, "TODO: backend cmd del_input"); wlr_log(L_DEBUG, "TODO: backend cmd del_input");
return NULL; return NULL;
} }

View file

@ -21,6 +21,7 @@
#include "sway/config.h" #include "sway/config.h"
#include "sway/server.h" #include "sway/server.h"
#include "sway/input/input-manager.h" #include "sway/input/input-manager.h"
#include "log.h"
static void server_ready(struct wl_listener *listener, void *data) { static void server_ready(struct wl_listener *listener, void *data) {
wlr_log(L_DEBUG, "Compositor is ready, executing cmds in queue"); wlr_log(L_DEBUG, "Compositor is ready, executing cmds in queue");
@ -135,7 +136,7 @@ struct sway_subbackend *sway_subbackend_create(enum sway_subbackend_type type,
struct sway_subbackend *subbackend = struct sway_subbackend *subbackend =
calloc(1, sizeof(struct sway_subbackend)); calloc(1, sizeof(struct sway_subbackend));
if (subbackend == NULL) { if (subbackend == NULL) {
sway_log(L_ERROR, "could not allocate subbackend"); wlr_log(L_ERROR, "could not allocate subbackend");
return NULL; return NULL;
} }
@ -163,7 +164,7 @@ static void handle_subbackend_backend_destroy(struct wl_listener *listener,
} }
static struct wlr_backend *wayland_backend_create(struct sway_server *server) { static struct wlr_backend *wayland_backend_create(struct sway_server *server) {
sway_log(L_DEBUG, "TODO: create wayland backend"); wlr_log(L_DEBUG, "TODO: create wayland backend");
return NULL; return NULL;
/* /*
struct wlr_backend *backend = struct wlr_backend *backend =
@ -174,13 +175,13 @@ static struct wlr_backend *wayland_backend_create(struct sway_server *server) {
} }
static struct wlr_backend *x11_backend_create(struct sway_server *server) { static struct wlr_backend *x11_backend_create(struct sway_server *server) {
sway_log(L_DEBUG, "TODO: create x11 backend"); wlr_log(L_DEBUG, "TODO: create x11 backend");
return NULL; return NULL;
} }
static struct wlr_backend *headless_backend_create( static struct wlr_backend *headless_backend_create(
struct sway_server *server) { struct sway_server *server) {
sway_log(L_DEBUG, "TODO: create headless backend"); wlr_log(L_DEBUG, "TODO: create headless backend");
return NULL; return NULL;
/* /*
struct wlr_backend *backend = struct wlr_backend *backend =
@ -190,14 +191,14 @@ static struct wlr_backend *headless_backend_create(
} }
static struct wlr_backend *drm_backend_create(struct sway_server *server) { static struct wlr_backend *drm_backend_create(struct sway_server *server) {
sway_log(L_DEBUG, "TODO: create drm backend"); wlr_log(L_DEBUG, "TODO: create drm backend");
return NULL; return NULL;
} }
void sway_server_add_subbackend(struct sway_server *server, void sway_server_add_subbackend(struct sway_server *server,
struct sway_subbackend *subbackend) { struct sway_subbackend *subbackend) {
if (sway_server_get_subbackend(server, subbackend->name)) { if (sway_server_get_subbackend(server, subbackend->name)) {
sway_log(L_ERROR, "cannot add subbackend '%s': already exists", wlr_log(L_ERROR, "cannot add subbackend '%s': already exists",
subbackend->name); subbackend->name);
sway_subbackend_destroy(subbackend); sway_subbackend_destroy(subbackend);
return; return;
@ -221,7 +222,7 @@ void sway_server_add_subbackend(struct sway_server *server,
} }
if (backend == NULL) { if (backend == NULL) {
sway_log(L_ERROR, "could not create subbackend '%s'", subbackend->name); wlr_log(L_ERROR, "could not create subbackend '%s'", subbackend->name);
sway_subbackend_destroy(subbackend); sway_subbackend_destroy(subbackend);
return; return;
} }
@ -241,7 +242,7 @@ void sway_server_remove_subbackend(struct sway_server *server, char *name) {
sway_server_get_subbackend(server, name); sway_server_get_subbackend(server, name);
if (!subbackend) { if (!subbackend) {
sway_log(L_DEBUG, "could not find subbackend named '%s'", name); wlr_log(L_DEBUG, "could not find subbackend named '%s'", name);
return; return;
} }
@ -276,29 +277,30 @@ void sway_subbackend_add_output(struct sway_server *server,
switch(subbackend->type) { switch(subbackend->type) {
case SWAY_SUBBACKEND_WAYLAND: case SWAY_SUBBACKEND_WAYLAND:
sway_log(L_DEBUG, "TODO: create wayland subbackend output"); wlr_log(L_DEBUG, "TODO: create wayland subbackend output");
break; break;
case SWAY_SUBBACKEND_X11: case SWAY_SUBBACKEND_X11:
sway_log(L_DEBUG, "TODO: create x11 subbackend output"); wlr_log(L_DEBUG, "TODO: create x11 subbackend output");
break; break;
case SWAY_SUBBACKEND_DRM: case SWAY_SUBBACKEND_DRM:
sway_log(L_DEBUG, "creating DRM subbackend outputs is not supported"); wlr_log(L_DEBUG, "creating DRM subbackend outputs is not supported");
break; break;
case SWAY_SUBBACKEND_HEADLESS: case SWAY_SUBBACKEND_HEADLESS:
// TODO allow to name the output
wlr_output = wlr_output =
wlr_headless_add_output(subbackend->backend, 500, 500, name); wlr_headless_add_output(subbackend->backend, 500, 500);
break; break;
} }
if (wlr_output == NULL) { if (wlr_output == NULL) {
sway_log(L_ERROR, "could not create subbackend output '%s'", name); wlr_log(L_ERROR, "could not create subbackend output '%s'", name);
return; return;
} }
struct subbackend_output *output = struct subbackend_output *output =
calloc(1, sizeof(struct subbackend_output)); calloc(1, sizeof(struct subbackend_output));
if (output == NULL) { if (output == NULL) {
sway_log(L_ERROR, "could not allocate subbackend output"); wlr_log(L_ERROR, "could not allocate subbackend output");
return; return;
} }
@ -346,12 +348,13 @@ void sway_subbackend_add_input(struct sway_server *server,
struct sway_subbackend *subbackend, enum wlr_input_device_type type, struct sway_subbackend *subbackend, enum wlr_input_device_type type,
char *name) { char *name) {
if (subbackend->type != SWAY_SUBBACKEND_HEADLESS) { if (subbackend->type != SWAY_SUBBACKEND_HEADLESS) {
sway_log(L_DEBUG, "adding inputs is only supported for the headless backend"); wlr_log(L_DEBUG, "adding inputs is only supported for the headless backend");
return; return;
} }
// TODO allow naming the input device
struct wlr_input_device *device = struct wlr_input_device *device =
wlr_headless_add_input_device(subbackend->backend, type, name); wlr_headless_add_input_device(subbackend->backend, type);
if (device == NULL) { if (device == NULL) {
return; return;
} }
@ -359,7 +362,7 @@ void sway_subbackend_add_input(struct sway_server *server,
struct subbackend_input *input = struct subbackend_input *input =
calloc(1, sizeof(struct subbackend_input)); calloc(1, sizeof(struct subbackend_input));
if (input == NULL) { if (input == NULL) {
sway_log(L_ERROR, "could not allocate subbackend input device"); wlr_log(L_ERROR, "could not allocate subbackend input device");
return; return;
} }