aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--meson.build1
-rw-r--r--quirks.c22
-rw-r--r--quirks.h3
-rw-r--r--render.c4
-rw-r--r--search.c2
5 files changed, 26 insertions, 6 deletions
diff --git a/meson.build b/meson.build
index 21c23718..fcb85f90 100644
--- a/meson.build
+++ b/meson.build
@@ -112,6 +112,7 @@ executable(
'main.c',
'misc.c', 'misc.h',
'osc.c', 'osc.h',
+ 'quirks.c', 'quirks.h',
'render.c', 'render.h',
'search.c', 'search.h',
'selection.c', 'selection.h',
diff --git a/quirks.c b/quirks.c
index a1b1bafe..e96ad98e 100644
--- a/quirks.c
+++ b/quirks.c
@@ -3,8 +3,8 @@
#include <stdlib.h>
#include <stdbool.h>
-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);
+}
diff --git a/quirks.h b/quirks.h
index 1e087692..ce4b8b01 100644
--- a/quirks.h
+++ b/quirks.h
@@ -2,4 +2,5 @@
#include <wayland-client.h>
-void quirk_weston_subsurface_desync(struct wl_subsurface *sub);
+void quirk_weston_subsurface_desync_on(struct wl_subsurface *sub);
+void quirk_weston_subsurface_desync_off(struct wl_subsurface *sub);
diff --git a/render.c b/render.c
index 6e68f76b..df8a98de 100644
--- a/render.c
+++ b/render.c
@@ -18,6 +18,7 @@
#include "log.h"
#include "config.h"
#include "grid.h"
+#include "quirks.h"
#include "selection.h"
#include "shm.h"
@@ -1211,6 +1212,8 @@ render_search_box(struct terminal *term)
if (term->search.cursor >= term->search.len)
draw_bar(term, buf->pix, font, &fg, x, y);
+ quirk_weston_subsurface_desync_on(term->window->search_sub_surface);
+
/* TODO: this is only necessary on a window resize */
wl_subsurface_set_position(
term->window->search_sub_surface,
@@ -1229,6 +1232,7 @@ render_search_box(struct terminal *term)
}
wl_surface_commit(term->window->search_surface);
+ quirk_weston_subsurface_desync_off(term->window->search_sub_surface);
}
/* Move to terminal.c? */
diff --git a/search.c b/search.c
index 1c5d8e71..f81ce6c6 100644
--- a/search.c
+++ b/search.c
@@ -79,12 +79,12 @@ search_begin(struct terminal *term)
win->search_sub_surface = wl_subcompositor_get_subsurface(
wayl->sub_compositor, win->search_surface, win->surface);
- wl_subsurface_set_desync(win->search_sub_surface);
struct wl_region *region = wl_compositor_create_region(term->wl->compositor);
wl_region_add(region, 0, 0, INT32_MAX, INT32_MAX);
wl_surface_set_opaque_region(win->search_surface, region);
wl_region_destroy(region);
+ wl_subsurface_set_sync(win->search_sub_surface);
term->search.original_view = term->grid->view;
term->search.view_followed_offset = term->grid->view == term->grid->offset;