From c24eb7e31e750d2b9ba8f1b72f53b07a57495395 Mon Sep 17 00:00:00 2001 From: Roman Gilg Date: Tue, 28 Jul 2020 20:24:50 +0200 Subject: [PATCH] xwayland: Simplify Present event handling code Instead of optionally return early when an event is aborted and potentially clean it up in there we can only optionally inform Present if not aborted and afterwards clean it up if required. Saves some lines of code and conditional branches. Signed-off-by: Roman Gilg --- hw/xwayland/xwayland-present.c | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/hw/xwayland/xwayland-present.c b/hw/xwayland/xwayland-present.c index 7ef57e1f5..a4ecdada4 100644 --- a/hw/xwayland/xwayland-present.c +++ b/hw/xwayland/xwayland-present.c @@ -185,17 +185,11 @@ xwl_present_buffer_release(void *data) xwl_present_release_pixmap(event); - if (event->abort) { - if (!event->pending) - xwl_present_free_event(event); - return; - } + if (!event->abort) + present_wnmd_idle_notify(event->xwl_present_window->window, event->event_id); - present_wnmd_idle_notify(event->xwl_present_window->window, event->event_id); - - if (!event->pending) { + if (!event->pending) xwl_present_free_event(event); - } } static void @@ -279,20 +273,12 @@ xwl_present_sync_callback(void *data, event->pending = FALSE; - if (event->abort) { - /* Event might have been aborted */ - if (!event->pixmap) - /* Buffer was already released, cleanup now */ - xwl_present_free_event(event); - return; - } + if (!event->abort) + present_wnmd_flip_notify(xwl_present_window->window, event->event_id, + xwl_present_window->ust, xwl_present_window->msc); - present_wnmd_flip_notify(xwl_present_window->window, event->event_id, - xwl_present_window->ust, xwl_present_window->msc); - - if (!event->pixmap) { + if (!event->pixmap) xwl_present_free_event(event); - } } static const struct wl_callback_listener xwl_present_sync_listener = {