server: remove backend pointer

This commit is contained in:
Jente Hidskes 2020-02-08 16:49:12 +01:00
parent dc002acd20
commit 42782bda1d
No known key found for this signature in database
GPG key ID: 04BE5A29F32D91EA
4 changed files with 10 additions and 11 deletions

13
cage.c
View file

@ -246,6 +246,7 @@ main(int argc, char *argv[])
struct wl_event_source *sigint_source = NULL; struct wl_event_source *sigint_source = NULL;
struct wl_event_source *sigterm_source = NULL; struct wl_event_source *sigterm_source = NULL;
struct wl_event_source *sigchld_source = NULL; struct wl_event_source *sigchld_source = NULL;
struct wlr_backend *backend = NULL;
struct wlr_renderer *renderer = NULL; struct wlr_renderer *renderer = NULL;
struct wlr_compositor *compositor = NULL; struct wlr_compositor *compositor = NULL;
struct wlr_data_device_manager *data_device_manager = NULL; struct wlr_data_device_manager *data_device_manager = NULL;
@ -289,8 +290,8 @@ main(int argc, char *argv[])
sigint_source = wl_event_loop_add_signal(event_loop, SIGINT, handle_signal, &server.wl_display); sigint_source = wl_event_loop_add_signal(event_loop, SIGINT, handle_signal, &server.wl_display);
sigterm_source = wl_event_loop_add_signal(event_loop, SIGTERM, handle_signal, &server.wl_display); sigterm_source = wl_event_loop_add_signal(event_loop, SIGTERM, handle_signal, &server.wl_display);
server.backend = wlr_backend_autocreate(server.wl_display, NULL); backend = wlr_backend_autocreate(server.wl_display, NULL);
if (!server.backend) { if (!backend) {
wlr_log(WLR_ERROR, "Unable to create the wlroots backend"); wlr_log(WLR_ERROR, "Unable to create the wlroots backend");
ret = 1; ret = 1;
goto end; goto end;
@ -301,7 +302,7 @@ main(int argc, char *argv[])
goto end; goto end;
} }
renderer = wlr_backend_get_renderer(server.backend); renderer = wlr_backend_get_renderer(backend);
wlr_renderer_init_wl_display(renderer, server.wl_display); wlr_renderer_init_wl_display(renderer, server.wl_display);
wl_list_init(&server.views); wl_list_init(&server.views);
@ -332,9 +333,9 @@ main(int argc, char *argv[])
* available on the backend. We use this only to detect the * available on the backend. We use this only to detect the
* first output and ignore subsequent outputs. */ * first output and ignore subsequent outputs. */
server.new_output.notify = handle_new_output; server.new_output.notify = handle_new_output;
wl_signal_add(&server.backend->events.new_output, &server.new_output); wl_signal_add(&backend->events.new_output, &server.new_output);
server.seat = seat_create(&server); server.seat = seat_create(&server, backend);
if (!server.seat) { if (!server.seat) {
wlr_log(WLR_ERROR, "Unable to create the seat"); wlr_log(WLR_ERROR, "Unable to create the seat");
ret = 1; ret = 1;
@ -459,7 +460,7 @@ main(int argc, char *argv[])
goto end; goto end;
} }
if (!wlr_backend_start(server.backend)) { if (!wlr_backend_start(backend)) {
wlr_log(WLR_ERROR, "Unable to start the wlroots backend"); wlr_log(WLR_ERROR, "Unable to start the wlroots backend");
ret = 1; ret = 1;
goto end; goto end;

4
seat.c
View file

@ -720,7 +720,7 @@ handle_destroy(struct wl_listener *listener, void *data)
} }
struct cg_seat * struct cg_seat *
seat_create(struct cg_server *server) seat_create(struct cg_server *server, struct wlr_backend *backend)
{ {
struct cg_seat *seat = calloc(1, sizeof(struct cg_seat)); struct cg_seat *seat = calloc(1, sizeof(struct cg_seat));
if (!seat) { if (!seat) {
@ -788,7 +788,7 @@ seat_create(struct cg_server *server)
wl_list_init(&seat->touch); wl_list_init(&seat->touch);
seat->new_input.notify = handle_new_input; seat->new_input.notify = handle_new_input;
wl_signal_add(&server->backend->events.new_input, &seat->new_input); wl_signal_add(&backend->events.new_input, &seat->new_input);
wl_list_init(&seat->drag_icons); wl_list_init(&seat->drag_icons);
seat->request_start_drag.notify = handle_request_start_drag; seat->request_start_drag.notify = handle_request_start_drag;

2
seat.h
View file

@ -85,7 +85,7 @@ struct cg_drag_icon {
struct wl_listener destroy; struct wl_listener destroy;
}; };
struct cg_seat *seat_create(struct cg_server *server); struct cg_seat *seat_create(struct cg_server *server, struct wlr_backend *backend);
void seat_destroy(struct cg_seat *seat); void seat_destroy(struct cg_seat *seat);
struct cg_view *seat_get_focus(struct cg_seat *seat); struct cg_view *seat_get_focus(struct cg_seat *seat);
void seat_set_focus(struct cg_seat *seat, struct cg_view *view); void seat_set_focus(struct cg_seat *seat, struct cg_view *view);

View file

@ -4,7 +4,6 @@
#include "config.h" #include "config.h"
#include <wayland-server-core.h> #include <wayland-server-core.h>
#include <wlr/backend.h>
#include <wlr/types/wlr_idle.h> #include <wlr/types/wlr_idle.h>
#include <wlr/types/wlr_idle_inhibit_v1.h> #include <wlr/types/wlr_idle_inhibit_v1.h>
#include <wlr/types/wlr_output_layout.h> #include <wlr/types/wlr_output_layout.h>
@ -19,7 +18,6 @@
struct cg_server { struct cg_server {
struct wl_display *wl_display; struct wl_display *wl_display;
struct wlr_backend *backend;
struct wl_list views; struct wl_list views;
struct cg_seat *seat; struct cg_seat *seat;