mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-22 04:45:58 +01:00
Replace list_t with wl_list in wlr_wl_backend
Now wlr_backend->outputs is a list of wlr_wl_backend_output instead of wlr_output. Signed-off-by: Heghedus Razvan <heghedus.razvan@gmail.com>
This commit is contained in:
parent
e1f196a3e9
commit
d3f0878d71
5 changed files with 19 additions and 39 deletions
|
@ -64,16 +64,16 @@ static void wlr_wl_backend_destroy(struct wlr_backend *_backend) {
|
|||
return;
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < backend->outputs->length; ++i) {
|
||||
wlr_output_destroy(backend->outputs->items[i]);
|
||||
struct wlr_wl_backend_output *output, *tmp_output;
|
||||
wl_list_for_each_safe(output, tmp_output, &backend->outputs, link) {
|
||||
wlr_output_destroy(&output->wlr_output);
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < backend->devices->length; ++i) {
|
||||
wlr_input_device_destroy(backend->devices->items[i]);
|
||||
struct wlr_input_device *input_device, *tmp_input_device;
|
||||
wl_list_for_each_safe(input_device, tmp_input_device, &backend->devices, link) {
|
||||
wlr_input_device_destroy(input_device);
|
||||
}
|
||||
|
||||
list_free(backend->devices);
|
||||
list_free(backend->outputs);
|
||||
free(backend->seat_name);
|
||||
|
||||
wl_event_source_remove(backend->remote_display_src);
|
||||
|
@ -104,8 +104,8 @@ bool wlr_backend_is_wl(struct wlr_backend *b) {
|
|||
|
||||
struct wlr_wl_backend_output *wlr_wl_output_for_surface(
|
||||
struct wlr_wl_backend *backend, struct wl_surface *surface) {
|
||||
for (size_t i = 0; i < backend->outputs->length; ++i) {
|
||||
struct wlr_wl_backend_output *output = backend->outputs->items[i];
|
||||
struct wlr_wl_backend_output *output;
|
||||
wl_list_for_each(output, &backend->outputs, link) {
|
||||
if (output->surface == surface) {
|
||||
return output;
|
||||
}
|
||||
|
@ -123,15 +123,8 @@ struct wlr_backend *wlr_wl_backend_create(struct wl_display *display) {
|
|||
}
|
||||
wlr_backend_init(&backend->backend, &backend_impl);
|
||||
|
||||
if (!(backend->devices = list_create())) {
|
||||
wlr_log(L_ERROR, "Could not allocate devices list");
|
||||
goto error;
|
||||
}
|
||||
|
||||
if (!(backend->outputs = list_create())) {
|
||||
wlr_log(L_ERROR, "Could not allocate outputs list");
|
||||
goto error;
|
||||
}
|
||||
wl_list_init(&backend->devices);
|
||||
wl_list_init(&backend->outputs);
|
||||
|
||||
backend->local_display = display;
|
||||
|
||||
|
@ -150,12 +143,4 @@ struct wlr_backend *wlr_wl_backend_create(struct wl_display *display) {
|
|||
wlr_egl_bind_display(&backend->egl, backend->local_display);
|
||||
|
||||
return &backend->backend;
|
||||
|
||||
error:
|
||||
if (backend) {
|
||||
list_free(backend->devices);
|
||||
list_free(backend->outputs);
|
||||
}
|
||||
free(backend);
|
||||
return NULL;
|
||||
}
|
||||
|
|
|
@ -248,8 +248,8 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *_backend) {
|
|||
wlr_output->height = 480;
|
||||
strncpy(wlr_output->make, "wayland", sizeof(wlr_output->make));
|
||||
strncpy(wlr_output->model, "wayland", sizeof(wlr_output->model));
|
||||
snprintf(wlr_output->name, sizeof(wlr_output->name), "WL-%zd",
|
||||
backend->outputs->length + 1);
|
||||
snprintf(wlr_output->name, sizeof(wlr_output->name), "WL-%d",
|
||||
wl_list_length(&backend->outputs) + 1);
|
||||
wlr_output_update_matrix(wlr_output);
|
||||
|
||||
output->backend = backend;
|
||||
|
@ -306,10 +306,7 @@ struct wlr_output *wlr_wl_output_create(struct wlr_backend *_backend) {
|
|||
goto error;
|
||||
}
|
||||
|
||||
if (list_add(backend->outputs, wlr_output) == -1) {
|
||||
wlr_log(L_ERROR, "Allocation failed");
|
||||
goto error;
|
||||
}
|
||||
wl_list_insert(&backend->outputs, &output->link);
|
||||
wlr_output_create_global(wlr_output, backend->local_display);
|
||||
wl_signal_emit(&backend->backend.events.output_add, wlr_output);
|
||||
return wlr_output;
|
||||
|
|
|
@ -204,11 +204,7 @@ static struct wlr_input_device *allocate_device(struct wlr_wl_backend *backend,
|
|||
struct wlr_input_device *wlr_device = &wlr_wl_dev->wlr_input_device;
|
||||
wlr_input_device_init(wlr_device, type, &input_device_impl,
|
||||
name, vendor, product);
|
||||
if (list_add(backend->devices, wlr_device) == -1) {
|
||||
wlr_log_errno(L_ERROR, "Allocation failed");
|
||||
free(wlr_wl_dev);
|
||||
return NULL;
|
||||
}
|
||||
wl_list_insert(&backend->devices, &wlr_device->link);
|
||||
return wlr_device;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,7 @@
|
|||
#include <wlr/backend/wayland.h>
|
||||
#include <wlr/types/wlr_output.h>
|
||||
#include <wlr/types/wlr_input_device.h>
|
||||
#include <wlr/util/list.h>
|
||||
#include <wayland-util.h>
|
||||
|
||||
struct wlr_wl_backend {
|
||||
struct wlr_backend backend;
|
||||
|
@ -17,8 +17,8 @@ struct wlr_wl_backend {
|
|||
/* local state */
|
||||
bool started;
|
||||
struct wl_display *local_display;
|
||||
list_t *devices;
|
||||
list_t *outputs;
|
||||
struct wl_list devices;
|
||||
struct wl_list outputs;
|
||||
struct wlr_egl egl;
|
||||
size_t requested_outputs;
|
||||
/* remote state */
|
||||
|
@ -51,6 +51,7 @@ struct wlr_wl_backend_output {
|
|||
uint32_t enter_serial;
|
||||
|
||||
void *egl_surface;
|
||||
struct wl_list link;
|
||||
};
|
||||
|
||||
struct wlr_wl_input_device {
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#ifndef WLR_TYPES_WLR_OUTPUT_H
|
||||
#define WLR_TYPES_WLR_OUTPUT_H
|
||||
|
||||
#include <wayland-util.h>
|
||||
#include <wayland-server.h>
|
||||
#include <stdbool.h>
|
||||
|
||||
|
|
Loading…
Reference in a new issue