AtlatestRepositorysigil-wm
1
/* SPDX-License-Identifier: BSD-3-Clause2
* A test-owned barrier withholds presentation, without changing product code. */3
#define _GNU_SOURCE4
#include <dlfcn.h>5
#include <stdatomic.h>6
#include <stdlib.h>7
#include <unistd.h>8
#include <wlr/interfaces/wlr_output.h>9
static atomic_uint withheld;10
unsigned wm_test_withheld_presents(void) { return atomic_load(&withheld); }11
void wlr_output_send_present(struct wlr_output *output,12
struct wlr_output_event_present *event) {13
const char *barrier=getenv("SIGIL_WM_PRESENT_BARRIER");14
if(barrier && access(barrier,F_OK)==0) {15
atomic_fetch_add(&withheld,1);16
return;17
}18
typedef void (*present_fn)(struct wlr_output *,struct wlr_output_event_present *);19
present_fn present=(present_fn)dlsym(RTLD_NEXT,"wlr_output_send_present");20
if(!present) abort();21
present(output,event);22
}