From b8d79c719b77fb1e9f958353c62aea09d592067b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Ekl=C3=B6f?= Date: Sun, 1 Mar 2020 12:54:27 +0100 Subject: [PATCH] render: search: mark visible portion of sub-surface opaque --- quirks.c | 35 +++++++++++++++++++++++++++++++++++ quirks.h | 5 +++++ render.c | 7 +++++++ 3 files changed, 47 insertions(+) create mode 100644 quirks.c create mode 100644 quirks.h diff --git a/quirks.c b/quirks.c new file mode 100644 index 00000000..a1b1bafe --- /dev/null +++ b/quirks.c @@ -0,0 +1,35 @@ +#include "quirks.h" + +#include +#include + +void +quirk_weston_subsurface_desync(struct wl_subsurface *sub) +{ + /* + * On weston (8.0), synchronized subsurfaces aren't updated + * correctly. + + * They appear to render once, but after that, updates are + * sporadic. Sometimes they update, most of the time they + * don't. + * + * Adding explicit parent surface commits right after the + * subsurface commit doesn't help (and would be useless anyway, + * since it would defeat the purpose of having the subsurface + * synchronized in the first place). + */ + + static bool is_weston = false; + static bool initialized = false; + + if (!initialized) { + initialized = true; + is_weston = getenv("WESTON_CONFIG_FILE") != NULL; + } + + if (!is_weston) + return; + + wl_subsurface_set_desync(sub); +} diff --git a/quirks.h b/quirks.h new file mode 100644 index 00000000..1e087692 --- /dev/null +++ b/quirks.h @@ -0,0 +1,5 @@ +#pragma once + +#include + +void quirk_weston_subsurface_desync(struct wl_subsurface *sub); diff --git a/render.c b/render.c index 70d93033..d15aa756 100644 --- a/render.c +++ b/render.c @@ -1220,6 +1220,13 @@ render_search_box(struct terminal *term) wl_surface_damage_buffer(term->window->search_surface, 0, 0, width, height); wl_surface_set_buffer_scale(term->window->search_surface, scale); + struct wl_region *region = wl_compositor_create_region(term->wl->compositor); + if (region != NULL) { + wl_region_add(region, width - visible_width, 0, visible_width, height); + wl_surface_set_opaque_region(term->window->search_surface, region); + wl_region_destroy(region); + } + wl_surface_commit(term->window->search_surface); }