Use wlroots surface locking for transactions

References: https://github.com/swaywm/wlroots/issues/2957
This commit is contained in:
Simon Ser 2021-07-02 12:02:12 +02:00
parent 22226560e3
commit 6f9940c039
7 changed files with 92 additions and 140 deletions

View file

@ -42,6 +42,11 @@ void transaction_commit_dirty_client(void);
void transaction_notify_view_ready_by_serial(struct sway_view *view,
uint32_t serial);
/**
* Unlock the cached surface state held by the transaction system.
*/
void transaction_unlock_view_by_serial(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 geometry rather than by serial.

View file

@ -56,15 +56,6 @@ struct sway_view_impl {
void (*destroy)(struct sway_view *view);
};
struct sway_saved_buffer {
struct wlr_client_buffer *buffer;
int x, y;
int width, height;
enum wl_output_transform transform;
struct wlr_fbox source_box;
struct wl_list link; // sway_view::saved_buffers
};
struct sway_view {
enum sway_view_type type;
const struct sway_view_impl *impl;
@ -87,7 +78,8 @@ struct sway_view {
bool allow_request_urgent;
struct wl_event_source *urgent_timer;
struct wl_list saved_buffers; // sway_saved_buffer::link
bool surface_locked;
uint32_t surface_locked_seq;
// The geometry for whatever the client is committing, regardless of
// transaction state. Updated on every commit.
@ -129,6 +121,7 @@ struct sway_view {
struct sway_xdg_shell_view {
struct sway_view view;
struct wl_listener cache;
struct wl_listener commit;
struct wl_listener request_move;
struct wl_listener request_resize;
@ -357,9 +350,9 @@ void view_set_urgent(struct sway_view *view, bool enable);
bool view_is_urgent(struct sway_view *view);
void view_remove_saved_buffer(struct sway_view *view);
void view_lock_pending(struct sway_view *view);
void view_save_buffer(struct sway_view *view);
void view_unlock_pending(struct sway_view *view);
bool view_is_transient_for(struct sway_view *child, struct sway_view *ancestor);