From f9d6fcb1e4dda693884bc22f62ed05487788b3b5 Mon Sep 17 00:00:00 2001 From: tokyo4j Date: Sat, 22 Feb 2025 17:33:48 +0900 Subject: [PATCH] magnifier: use wlr_output.swapchain.format --- src/magnifier.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/src/magnifier.c b/src/magnifier.c index d9f316c1..d6700415 100644 --- a/src/magnifier.c +++ b/src/magnifier.c @@ -1,6 +1,7 @@ // SPDX-License-Identifier: GPL-2.0-only #include +#include #include #include "common/macros.h" #include "labwc.h" @@ -25,21 +26,6 @@ magnifier_draw(struct output *output, struct wlr_buffer *output_buffer, struct w struct wlr_fbox src_box; bool fullscreen = false; - /* TODO: This looks way too complicated to just get the used format */ - struct wlr_drm_format wlr_drm_format = {0}; - struct wlr_shm_attributes shm_attribs = {0}; - struct wlr_dmabuf_attributes dma_attribs = {0}; - if (wlr_buffer_get_dmabuf(output_buffer, &dma_attribs)) { - wlr_drm_format.format = dma_attribs.format; - wlr_drm_format.len = 1; - wlr_drm_format.modifiers = &dma_attribs.modifier; - } else if (wlr_buffer_get_shm(output_buffer, &shm_attribs)) { - wlr_drm_format.format = shm_attribs.format; - } else { - wlr_log(WLR_ERROR, "Failed to read buffer format"); - return; - } - /* Fetch scale-adjusted cursor coordinates */ struct server *server = output->server; struct theme *theme = server->theme; @@ -105,7 +91,8 @@ magnifier_draw(struct output *output, struct wlr_buffer *output_buffer, struct w } if (!tmp_buffer) { tmp_buffer = wlr_allocator_create_buffer( - server->allocator, width, height, &wlr_drm_format); + server->allocator, width, height, + &output->wlr_output->swapchain->format); } if (!tmp_buffer) { wlr_log(WLR_ERROR, "Failed to allocate temporary magnifier buffer");