mirror of
https://github.com/hyprwm/wlroots-hyprland.git
synced 2024-11-26 06:35:58 +01:00
Replace list_t with wl_list in wlr_output
Signed-off-by: Heghedus Razvan <heghedus.razvan@gmail.com>
This commit is contained in:
parent
c03e774636
commit
1d716241af
5 changed files with 19 additions and 19 deletions
|
@ -782,11 +782,7 @@ void wlr_drm_scan_connectors(struct wlr_drm_backend *drm) {
|
||||||
mode->wlr_mode.width, mode->wlr_mode.height,
|
mode->wlr_mode.width, mode->wlr_mode.height,
|
||||||
mode->wlr_mode.refresh);
|
mode->wlr_mode.refresh);
|
||||||
|
|
||||||
if (list_add(wlr_conn->output.modes, mode) == -1) {
|
wl_list_insert(&wlr_conn->output.modes, &mode->wlr_mode.link);
|
||||||
wlr_log_errno(L_ERROR, "Allocation failed");
|
|
||||||
free(mode);
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wlr_conn->state = WLR_DRM_CONN_NEEDS_MODESET;
|
wlr_conn->state = WLR_DRM_CONN_NEEDS_MODESET;
|
||||||
|
|
|
@ -427,8 +427,10 @@ static void output_add_notify(struct wl_listener *listener, void *data) {
|
||||||
wlr_log(L_DEBUG, "Output '%s' added", output->name);
|
wlr_log(L_DEBUG, "Output '%s' added", output->name);
|
||||||
wlr_log(L_DEBUG, "%s %s %"PRId32"mm x %"PRId32"mm", output->make, output->model,
|
wlr_log(L_DEBUG, "%s %s %"PRId32"mm x %"PRId32"mm", output->make, output->model,
|
||||||
output->phys_width, output->phys_height);
|
output->phys_width, output->phys_height);
|
||||||
if (output->modes->length > 0) {
|
if (wl_list_length(&output->modes) > 0) {
|
||||||
wlr_output_set_mode(output, output->modes->items[0]);
|
struct wlr_output_mode *mode = NULL;
|
||||||
|
wl_container_of((&output->modes)->prev, mode, link);
|
||||||
|
wlr_output_set_mode(output, mode);
|
||||||
}
|
}
|
||||||
struct output_state *ostate = calloc(1, sizeof(struct output_state));
|
struct output_state *ostate = calloc(1, sizeof(struct output_state));
|
||||||
clock_gettime(CLOCK_MONOTONIC, &ostate->last_frame);
|
clock_gettime(CLOCK_MONOTONIC, &ostate->last_frame);
|
||||||
|
|
|
@ -2,13 +2,13 @@
|
||||||
#define WLR_TYPES_WLR_OUTPUT_H
|
#define WLR_TYPES_WLR_OUTPUT_H
|
||||||
|
|
||||||
#include <wayland-server.h>
|
#include <wayland-server.h>
|
||||||
#include <wlr/util/list.h>
|
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
struct wlr_output_mode {
|
struct wlr_output_mode {
|
||||||
uint32_t flags; // enum wl_output_mode
|
uint32_t flags; // enum wl_output_mode
|
||||||
int32_t width, height;
|
int32_t width, height;
|
||||||
int32_t refresh; // mHz
|
int32_t refresh; // mHz
|
||||||
|
struct wl_list link;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct wlr_output_impl;
|
struct wlr_output_impl;
|
||||||
|
@ -32,7 +32,7 @@ struct wlr_output {
|
||||||
float transform_matrix[16];
|
float transform_matrix[16];
|
||||||
|
|
||||||
/* Note: some backends may have zero modes */
|
/* Note: some backends may have zero modes */
|
||||||
list_t *modes;
|
struct wl_list modes;
|
||||||
struct wlr_output_mode *current_mode;
|
struct wlr_output_mode *current_mode;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
@ -166,8 +166,10 @@ void output_add_notify(struct wl_listener *listener, void *data) {
|
||||||
wlr_log(L_DEBUG, "%s %s %"PRId32"mm x %"PRId32"mm",
|
wlr_log(L_DEBUG, "%s %s %"PRId32"mm x %"PRId32"mm",
|
||||||
wlr_output->make, wlr_output->model,
|
wlr_output->make, wlr_output->model,
|
||||||
wlr_output->phys_width, wlr_output->phys_height);
|
wlr_output->phys_width, wlr_output->phys_height);
|
||||||
if (wlr_output->modes->length > 0) {
|
if (wl_list_length(&wlr_output->modes) > 0) {
|
||||||
wlr_output_set_mode(wlr_output, wlr_output->modes->items[0]);
|
struct wlr_output_mode *mode = NULL;
|
||||||
|
mode = wl_container_of((&wlr_output->modes)->prev, mode, link);
|
||||||
|
wlr_output_set_mode(wlr_output, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
struct roots_output *output = calloc(1, sizeof(struct roots_output));
|
struct roots_output *output = calloc(1, sizeof(struct roots_output));
|
||||||
|
|
|
@ -26,8 +26,8 @@ static void wl_output_send_to_resource(struct wl_resource *resource) {
|
||||||
output->make, output->model, output->transform);
|
output->make, output->model, output->transform);
|
||||||
}
|
}
|
||||||
if (version >= WL_OUTPUT_MODE_SINCE_VERSION) {
|
if (version >= WL_OUTPUT_MODE_SINCE_VERSION) {
|
||||||
for (size_t i = 0; i < output->modes->length; ++i) {
|
struct wlr_output_mode *mode;
|
||||||
struct wlr_output_mode *mode = output->modes->items[i];
|
wl_list_for_each(mode, &output->modes, link) {
|
||||||
// TODO: mode->flags should just be preferred
|
// TODO: mode->flags should just be preferred
|
||||||
uint32_t flags = mode->flags;
|
uint32_t flags = mode->flags;
|
||||||
if (output->current_mode == mode) {
|
if (output->current_mode == mode) {
|
||||||
|
@ -37,7 +37,7 @@ static void wl_output_send_to_resource(struct wl_resource *resource) {
|
||||||
mode->width, mode->height, mode->refresh);
|
mode->width, mode->height, mode->refresh);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (output->modes->length == 0) {
|
if (wl_list_length(&output->modes) == 0) {
|
||||||
// Output has no mode, send the current width/height
|
// Output has no mode, send the current width/height
|
||||||
wl_output_send_mode(resource, WL_OUTPUT_MODE_CURRENT,
|
wl_output_send_mode(resource, WL_OUTPUT_MODE_CURRENT,
|
||||||
output->width, output->height, 0);
|
output->width, output->height, 0);
|
||||||
|
@ -296,7 +296,7 @@ bool wlr_output_move_cursor(struct wlr_output *output, int x, int y) {
|
||||||
void wlr_output_init(struct wlr_output *output,
|
void wlr_output_init(struct wlr_output *output,
|
||||||
const struct wlr_output_impl *impl) {
|
const struct wlr_output_impl *impl) {
|
||||||
output->impl = impl;
|
output->impl = impl;
|
||||||
output->modes = list_create();
|
wl_list_init(&output->modes);
|
||||||
output->transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
output->transform = WL_OUTPUT_TRANSFORM_NORMAL;
|
||||||
output->scale = 1;
|
output->scale = 1;
|
||||||
wl_signal_init(&output->events.frame);
|
wl_signal_init(&output->events.frame);
|
||||||
|
@ -320,11 +320,11 @@ void wlr_output_destroy(struct wlr_output *output) {
|
||||||
wlr_texture_destroy(output->cursor.texture);
|
wlr_texture_destroy(output->cursor.texture);
|
||||||
wlr_renderer_destroy(output->cursor.renderer);
|
wlr_renderer_destroy(output->cursor.renderer);
|
||||||
|
|
||||||
for (size_t i = 0; output->modes && i < output->modes->length; ++i) {
|
struct wlr_output_mode *mode, *tmp_mode;
|
||||||
struct wlr_output_mode *mode = output->modes->items[i];
|
wl_list_for_each_safe(mode, tmp_mode, &output->modes, link) {
|
||||||
free(mode);
|
free(mode);
|
||||||
}
|
}
|
||||||
list_free(output->modes);
|
wl_list_remove(&output->modes);
|
||||||
if (output->impl && output->impl->destroy) {
|
if (output->impl && output->impl->destroy) {
|
||||||
output->impl->destroy(output);
|
output->impl->destroy(output);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue