mirror of
https://github.com/swaywm/sway.git
synced 2026-04-23 06:46:27 -04:00
xwayland: notify txn system on cache event
This commit is contained in:
parent
47d0d18db9
commit
e7a995a00d
2 changed files with 17 additions and 8 deletions
|
|
@ -134,6 +134,7 @@ struct sway_xdg_shell_view {
|
|||
struct sway_xwayland_view {
|
||||
struct sway_view view;
|
||||
|
||||
struct wl_listener cache;
|
||||
struct wl_listener commit;
|
||||
struct wl_listener request_move;
|
||||
struct wl_listener request_resize;
|
||||
|
|
|
|||
|
|
@ -388,12 +388,21 @@ static void get_geometry(struct sway_view *view, struct wlr_box *box) {
|
|||
}
|
||||
}
|
||||
|
||||
static void handle_cache(struct wl_listener *listener, void *data) {
|
||||
struct sway_xwayland_view *xwayland_view =
|
||||
wl_container_of(listener, xwayland_view, cache);
|
||||
struct sway_view *view = &xwayland_view->view;
|
||||
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
|
||||
struct wlr_surface_state *cached = data;
|
||||
transaction_notify_view_acked_by_geometry(view,
|
||||
xsurface->x, xsurface->y, cached->width, cached->height);
|
||||
transaction_notify_view_ready(view);
|
||||
}
|
||||
|
||||
static void handle_commit(struct wl_listener *listener, void *data) {
|
||||
struct sway_xwayland_view *xwayland_view =
|
||||
wl_container_of(listener, xwayland_view, commit);
|
||||
struct sway_view *view = &xwayland_view->view;
|
||||
struct wlr_xwayland_surface *xsurface = view->wlr_xwayland_surface;
|
||||
struct wlr_surface_state *state = &xsurface->surface->current;
|
||||
|
||||
struct wlr_box new_geo;
|
||||
get_geometry(view, &new_geo);
|
||||
|
|
@ -417,12 +426,6 @@ static void handle_commit(struct wl_listener *listener, void *data) {
|
|||
desktop_damage_view(view);
|
||||
}
|
||||
|
||||
if (view->container->node.instruction) {
|
||||
transaction_notify_view_acked_by_geometry(view,
|
||||
xsurface->x, xsurface->y, state->width, state->height);
|
||||
transaction_notify_view_ready(view);
|
||||
}
|
||||
|
||||
view_damage_from(view);
|
||||
}
|
||||
|
||||
|
|
@ -434,6 +437,7 @@ static void handle_destroy(struct wl_listener *listener, void *data) {
|
|||
if (view->surface) {
|
||||
view_unmap(view);
|
||||
wl_list_remove(&xwayland_view->commit.link);
|
||||
wl_list_remove(&xwayland_view->cache.link);
|
||||
}
|
||||
|
||||
wl_list_remove(&xwayland_view->destroy.link);
|
||||
|
|
@ -467,6 +471,7 @@ static void handle_unmap(struct wl_listener *listener, void *data) {
|
|||
view_unmap(view);
|
||||
|
||||
wl_list_remove(&xwayland_view->commit.link);
|
||||
wl_list_remove(&xwayland_view->cache.link);
|
||||
}
|
||||
|
||||
static void handle_map(struct wl_listener *listener, void *data) {
|
||||
|
|
@ -483,6 +488,9 @@ static void handle_map(struct wl_listener *listener, void *data) {
|
|||
wl_signal_add(&xsurface->surface->events.commit, &xwayland_view->commit);
|
||||
xwayland_view->commit.notify = handle_commit;
|
||||
|
||||
wl_signal_add(&xsurface->surface->events.cache, &xwayland_view->cache);
|
||||
xwayland_view->cache.notify = handle_cache;
|
||||
|
||||
// Put it back into the tree
|
||||
view_map(view, xsurface->surface, xsurface->fullscreen, NULL, false);
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue