mirror of
https://codeberg.org/dnkl/foot.git
synced 2026-02-04 04:06:06 -05:00
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.
This commit is contained in:
parent
bd13c2c86a
commit
c94da979fb
1 changed files with 29 additions and 1 deletions
30
wayland.c
30
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 = {
|
||||
|
|
@ -946,6 +961,19 @@ wayl_terminal_from_surface(struct wayland *wayl, struct wl_surface *surface)
|
|||
return NULL;
|
||||
}
|
||||
|
||||
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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue