From b6f8a2e422fe05c1c1e63d39f72857d4c480bc7c Mon Sep 17 00:00:00 2001 From: Daniel Eklöf Date: Sun, 1 Mar 2020 13:06:00 +0100 Subject: search: enable/disable weston sub-surface desync quirk when rendering search box --- quirks.c | 22 ++++++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) (limited to 'quirks.c') diff --git a/quirks.c b/quirks.c index a1b1bafe..e96ad98e 100644 --- a/quirks.c +++ b/quirks.c @@ -3,8 +3,8 @@ #include #include -void -quirk_weston_subsurface_desync(struct wl_subsurface *sub) +static bool +is_weston(void) { /* * On weston (8.0), synchronized subsurfaces aren't updated @@ -19,7 +19,6 @@ quirk_weston_subsurface_desync(struct wl_subsurface *sub) * since it would defeat the purpose of having the subsurface * synchronized in the first place). */ - static bool is_weston = false; static bool initialized = false; @@ -28,8 +27,23 @@ quirk_weston_subsurface_desync(struct wl_subsurface *sub) is_weston = getenv("WESTON_CONFIG_FILE") != NULL; } - if (!is_weston) + return is_weston; +} + +void +quirk_weston_subsurface_desync_on(struct wl_subsurface *sub) +{ + if (!is_weston()) return; wl_subsurface_set_desync(sub); } + +void +quirk_weston_subsurface_desync_off(struct wl_subsurface *sub) +{ + if (!is_weston()) + return; + + wl_subsurface_set_sync(sub); +} -- cgit v1.3