From 6906e6694aa77fe7b92127e59be9d2132154bd08 Mon Sep 17 00:00:00 2001 From: Yuxuan Shui Date: Wed, 14 Dec 2022 14:28:42 +0000 Subject: [PATCH] core: add set_cant_fail_cookie Enables picom to abort when certain requests fail. Signed-off-by: Yuxuan Shui --- src/common.h | 19 ++++++++++++------- 1 file changed, 12 insertions(+), 7 deletions(-) diff --git a/src/common.h b/src/common.h index 21c76b7..f1e5d8a 100644 --- a/src/common.h +++ b/src/common.h @@ -481,11 +481,8 @@ static inline bool bkend_use_glx(session_t *ps) { return BKEND_GLX == ps->o.backend || BKEND_XR_GLX_HYBRID == ps->o.backend; } -static void set_ignore(session_t *ps, uint32_t sequence) { - if (ps->o.show_all_xerrors) { - return; - } - +static void +set_reply_action(session_t *ps, uint32_t sequence, enum pending_reply_action action) { auto i = cmalloc(pending_reply_t); if (!i) { abort(); @@ -493,7 +490,7 @@ static void set_ignore(session_t *ps, uint32_t sequence) { i->sequence = sequence; i->next = 0; - i->action = PENDING_REPLY_ACTION_IGNORE; + i->action = action; *ps->pending_reply_tail = i; ps->pending_reply_tail = &i->next; } @@ -502,7 +499,15 @@ static void set_ignore(session_t *ps, uint32_t sequence) { * Ignore X errors caused by given X request. */ static inline void set_ignore_cookie(session_t *ps, xcb_void_cookie_t cookie) { - set_ignore(ps, cookie.sequence); + if (ps->o.show_all_xerrors) { + return; + } + + set_reply_action(ps, cookie.sequence, PENDING_REPLY_ACTION_IGNORE); +} + +static inline void set_cant_fail_cookie(session_t *ps, xcb_void_cookie_t cookie) { + set_reply_action(ps, cookie.sequence, PENDING_REPLY_ACTION_ABORT); } /**