aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDaniel Eklöf <daniel@ekloef.se>2020-01-03 11:45:58 +0000
committerDaniel Eklöf <daniel@ekloef.se>2020-01-03 11:48:54 +0000
commitc94da979fbe3d0267373717fc87654caa0bcfa72 (patch)
tree4bf7ab2d80393df2a26727fbb5d45d52b7a064bb
parentterm: render_resize() now takes a 'refresh' argument (diff)
wayland: xdg-surface-configure: refresh terminal
Any changes done in any of the configure events are ignored before we've ack:ed the configure event. In particular, this means the resize done in xdg-toplevel-configure isn't displayed until the next time we call render_refresh(). Unless we do something ourselves, this can take quite some time, since we're basically need the slave to write something. So, in xdg-surface-configure, *after* having ack:ed the configure event, call render_refresh() to make the changes done in xdg-toplevel-configure visible as soon as possible.
-rw-r--r--wayland.c30
1 files changed, 29 insertions, 1 deletions
diff --git a/wayland.c b/wayland.c
index ea4b2d40..76c2f5d3 100644
--- a/wayland.c
+++ b/wayland.c
@@ -453,8 +453,23 @@ static void
xdg_surface_configure(void *data, struct xdg_surface *xdg_surface,
uint32_t serial)
{
- //LOG_DBG("xdg-surface: configure");
+ LOG_DBG("xdg-surface: configure");
xdg_surface_ack_configure(xdg_surface, serial);
+
+ /*
+ * Changes done in e.g. xdg-toplevel-configure will be ignored
+ * since the 'configure' event hasn't been ack:ed yet.
+ *
+ * Unfortunately, *this* function is called *last*, meaning we
+ * have no way of acking the configure before we resize the
+ * terminal in xdg-toplevel-configure.
+ *
+ * So, refresh here, to ensure changes take effect as soon as possible.
+ */
+ struct wayland *wayl = data;
+ struct terminal *term = wayl_terminal_from_xdg_surface(wayl, xdg_surface);
+ if (term->width > 0 && term->height > 0)
+ render_refresh(term);
}
static const struct xdg_surface_listener xdg_surface_listener = {
@@ -947,6 +962,19 @@ wayl_terminal_from_surface(struct wayland *wayl, struct wl_surface *surface)
}
struct terminal *
+wayl_terminal_from_xdg_surface(struct wayland *wayl,
+ struct xdg_surface *surface)
+{
+ tll_foreach(wayl->terms, it) {
+ if (it->item->window->xdg_surface == surface)
+ return it->item;
+ }
+
+ assert(false);
+ return NULL;
+}
+
+struct terminal *
wayl_terminal_from_xdg_toplevel(struct wayland *wayl,
struct xdg_toplevel *toplevel)
{