mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
wayland: use wl_shm v2 if available
This commit is contained in:
parent
1fd4076082
commit
4f25e1ba9f
2 changed files with 17 additions and 3 deletions
17
wayland.c
17
wayland.c
|
|
@ -1120,9 +1120,16 @@ handle_global(void *data, struct wl_registry *registry,
|
|||
if (!verify_iface_version(interface, version, required))
|
||||
return;
|
||||
|
||||
#if defined(WL_SHM_RELEASE_SINCE_VERSION)
|
||||
const uint32_t preferred = WL_SHM_RELEASE_SINCE_VERSION;
|
||||
#else
|
||||
const uint32_t preferred = required;
|
||||
#endif
|
||||
|
||||
wayl->shm = wl_registry_bind(
|
||||
wayl->registry, name, &wl_shm_interface, required);
|
||||
wayl->registry, name, &wl_shm_interface, min(version, preferred));
|
||||
wl_shm_add_listener(wayl->shm, &shm_listener, wayl);
|
||||
wayl->use_shm_release = version >= WL_SHM_RELEASE_SINCE_VERSION;
|
||||
}
|
||||
|
||||
else if (streq(interface, xdg_wm_base_interface.name)) {
|
||||
|
|
@ -1690,8 +1697,12 @@ wayl_destroy(struct wayland *wayl)
|
|||
wl_data_device_manager_destroy(wayl->data_device_manager);
|
||||
if (wayl->primary_selection_device_manager != NULL)
|
||||
zwp_primary_selection_device_manager_v1_destroy(wayl->primary_selection_device_manager);
|
||||
if (wayl->shm != NULL)
|
||||
wl_shm_destroy(wayl->shm);
|
||||
if (wayl->shm != NULL) {
|
||||
if (wayl->use_shm_release)
|
||||
wl_shm_release(wayl->shm);
|
||||
else
|
||||
wl_shm_destroy(wayl->shm);
|
||||
}
|
||||
if (wayl->sub_compositor != NULL)
|
||||
wl_subcompositor_destroy(wayl->sub_compositor);
|
||||
if (wayl->compositor != NULL)
|
||||
|
|
|
|||
|
|
@ -455,6 +455,9 @@ struct wayland {
|
|||
tll(struct seat) seats;
|
||||
|
||||
tll(struct terminal *) terms;
|
||||
|
||||
/* WL_SHM >= 2 */
|
||||
bool use_shm_release;
|
||||
};
|
||||
|
||||
struct wayland *wayl_init(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue