mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-05 04:06:08 -05:00
main: verify compositor has WL_SHM_FORMAT_ARGB8888
This commit is contained in:
parent
1e2a7e77f0
commit
729974492d
2 changed files with 9 additions and 1 deletions
9
main.c
9
main.c
|
|
@ -38,6 +38,9 @@ static const struct rgb default_background = {0.067, 0.067, 0.067};
|
|||
static void
|
||||
shm_format(void *data, struct wl_shm *wl_shm, uint32_t format)
|
||||
{
|
||||
struct terminal *term = data;
|
||||
if (format == WL_SHM_FORMAT_ARGB8888)
|
||||
term->wl.have_argb8888 = true;
|
||||
}
|
||||
|
||||
static const struct wl_shm_listener shm_listener = {
|
||||
|
|
@ -107,7 +110,7 @@ handle_global(void *data, struct wl_registry *registry,
|
|||
else if (strcmp(interface, wl_shm_interface.name) == 0) {
|
||||
term->wl.shm = wl_registry_bind(
|
||||
term->wl.registry, name, &wl_shm_interface, 1);
|
||||
wl_shm_add_listener(term->wl.shm, &shm_listener, NULL);
|
||||
wl_shm_add_listener(term->wl.shm, &shm_listener, term);
|
||||
wl_display_roundtrip(term->wl.display);
|
||||
}
|
||||
|
||||
|
|
@ -378,6 +381,10 @@ main(int argc, char *const *argv)
|
|||
LOG_ERR("no XDG shell interface");
|
||||
goto out;
|
||||
}
|
||||
if (!term.wl.have_argb8888) {
|
||||
LOG_ERR("compositor does not support ARGB surfaces");
|
||||
goto out;
|
||||
}
|
||||
|
||||
/* Cursor */
|
||||
term.wl.pointer.surface = wl_compositor_create_surface(term.wl.compositor);
|
||||
|
|
|
|||
|
|
@ -34,6 +34,7 @@ struct wayland {
|
|||
struct xdg_wm_base *shell;
|
||||
struct xdg_surface *xdg_surface;
|
||||
struct xdg_toplevel *xdg_toplevel;
|
||||
bool have_argb8888;
|
||||
};
|
||||
|
||||
struct rgb { double r, g, b; } __attribute__((packed));
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue