From 1d716241afbc721c3ae65d4a2bb0e25866fe081c Mon Sep 17 00:00:00 2001 From: Heghedus Razvan Date: Sun, 15 Oct 2017 13:32:37 +0300 Subject: Replace list_t with wl_list in wlr_output Signed-off-by: Heghedus Razvan --- examples/shared.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'examples/shared.c') diff --git a/examples/shared.c b/examples/shared.c index bb1d2737..d9f9ae61 100644 --- a/examples/shared.c +++ b/examples/shared.c @@ -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, "%s %s %"PRId32"mm x %"PRId32"mm", output->make, output->model, output->phys_width, output->phys_height); - if (output->modes->length > 0) { - wlr_output_set_mode(output, output->modes->items[0]); + if (wl_list_length(&output->modes) > 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)); clock_gettime(CLOCK_MONOTONIC, &ostate->last_frame); -- cgit v1.2.3 From a299b9d8757755b3daf7137825ca0bc01a2d9330 Mon Sep 17 00:00:00 2001 From: Timidger Date: Sun, 22 Oct 2017 19:29:24 -0700 Subject: Fixes #321, not using result of wl_container_of --- examples/shared.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'examples/shared.c') diff --git a/examples/shared.c b/examples/shared.c index 4cde15d1..1a1f4be4 100644 --- a/examples/shared.c +++ b/examples/shared.c @@ -414,8 +414,8 @@ static void output_add_notify(struct wl_listener *listener, void *data) { wlr_log(L_DEBUG, "%s %s %"PRId32"mm x %"PRId32"mm", output->make, output->model, output->phys_width, output->phys_height); if (wl_list_length(&output->modes) > 0) { - struct wlr_output_mode *mode = NULL; - wl_container_of((&output->modes)->prev, mode, link); + struct wlr_output_mode *mode; + mode = wl_container_of((&output->modes)->prev, mode, link); wlr_output_set_mode(output, mode); } struct output_state *ostate = calloc(1, sizeof(struct output_state)); -- cgit v1.2.3