d10ccc1eb1
Fixes #2364. Suppose a view is 600px wide, and we tell it to resize to 601px during a resize operation. We create a transaction, save the 600px buffer and send the configure. This buffer is saved into the associated instruction, and is rendered while we wait for the view to commit a 601px buffer. Before the view commits the 601px buffer, suppose we tell it to resize to 602px. The new transaction will also save the buffer, but it's still the 600px buffer because we haven't received a new one yet. Then suppose the view commits its original 601px buffer. This completes the first transaction, so we apply the 601px width to the container. There's still the second (now only) transaction remaining, so we render the saved buffer from that. But this is still the 600px buffer, and we believe it's 601px. Whoops. The problem here is we can't stack buffers like this. So this commit removes the saved buffer from the instructions, places it in the view instead, and re-saves the latest buffer every time the view completes a transaction and still has further pending transactions. As saved buffers are now specific to views rather than instructions, the functions for saving and removing the saved buffer have been moved to view.c. The calls to save and restore the buffer have been relocated to more appropriate functions too, favouring transaction_commit and transaction_apply rather than transaction_add_container and transaction_destroy.
46 lines
1.5 KiB
C
46 lines
1.5 KiB
C
#ifndef _SWAY_TRANSACTION_H
|
|
#define _SWAY_TRANSACTION_H
|
|
#include <wlr/render/wlr_texture.h>
|
|
#include "sway/tree/container.h"
|
|
|
|
/**
|
|
* Transactions enable us to perform atomic layout updates.
|
|
*
|
|
* A transaction contains a list of containers and their new state.
|
|
* A state might contain a new size, or new border settings, or new parent/child
|
|
* relationships.
|
|
*
|
|
* Committing a transaction makes sway notify of all the affected clients with
|
|
* their new sizes. We then wait for all the views to respond with their new
|
|
* surface sizes. When all are ready, or when a timeout has passed, we apply the
|
|
* updates all at the same time.
|
|
*
|
|
* When we want to make adjustments to the layout, we change the pending state
|
|
* in containers, mark them as dirty and call transaction_commit_dirty(). This
|
|
* create and commits a transaction from the dirty containers.
|
|
*/
|
|
|
|
/**
|
|
* Find all dirty containers, create and commit a transaction containing them,
|
|
* and unmark them as dirty.
|
|
*/
|
|
void transaction_commit_dirty(void);
|
|
|
|
/**
|
|
* Notify the transaction system that a view is ready for the new layout.
|
|
*
|
|
* When all views in the transaction are ready, the layout will be applied.
|
|
*/
|
|
void transaction_notify_view_ready(struct sway_view *view, uint32_t serial);
|
|
|
|
/**
|
|
* Notify the transaction system that a view is ready for the new layout, but
|
|
* identifying the instruction by width and height rather than by serial.
|
|
*
|
|
* This is used by xwayland views, as they don't have serials.
|
|
*/
|
|
void transaction_notify_view_ready_by_size(struct sway_view *view,
|
|
int width, int height);
|
|
|
|
#endif
|