aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/sway/desktop/transaction.h12
-rw-r--r--sway/desktop/transaction.c14
-rw-r--r--sway/desktop/xdg_shell.c3
-rw-r--r--sway/desktop/xwayland.c8
4 files changed, 26 insertions, 11 deletions
diff --git a/include/sway/desktop/transaction.h b/include/sway/desktop/transaction.h
index 66e8c9a2..175489c5 100644
--- a/include/sway/desktop/transaction.h
+++ b/include/sway/desktop/transaction.h
@@ -38,11 +38,17 @@ void transaction_notify_view_ready_by_serial(struct sway_view *view,
/**
* 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.
+ * identifying the instruction by geometry 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);
+void transaction_notify_view_ready_by_geometry(struct sway_view *view,
+ double x, double y, int width, int height);
+
+/**
+ * Unconditionally notify the transaction system that a view is ready for the
+ * new layout.
+ */
+void transaction_notify_view_ready_immediately(struct sway_view *view);
#endif
diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c
index 0d0e0635..e186bf89 100644
--- a/sway/desktop/transaction.c
+++ b/sway/desktop/transaction.c
@@ -510,17 +510,27 @@ void transaction_notify_view_ready_by_serial(struct sway_view *view,
}
}
-void transaction_notify_view_ready_by_size(struct sway_view *view,
- int width, int height) {
+void transaction_notify_view_ready_by_geometry(struct sway_view *view,
+ double x, double y, int width, int height) {
struct sway_transaction_instruction *instruction =
view->container->node.instruction;
if (instruction != NULL &&
+ (int)instruction->container_state.content_x == (int)x &&
+ (int)instruction->container_state.content_y == (int)y &&
instruction->container_state.content_width == width &&
instruction->container_state.content_height == height) {
set_instruction_ready(instruction);
}
}
+void transaction_notify_view_ready_immediately(struct sway_view *view) {
+ struct sway_transaction_instruction *instruction =
+ view->container->node.instruction;
+ if (instruction != NULL) {
+ set_instruction_ready(instruction);
+ }
+}
+
void transaction_commit_dirty(void) {
if (!server.dirty_nodes->length) {
return;
diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c
index 03f37241..4d133a12 100644
--- a/sway/desktop/xdg_shell.c
+++ b/sway/desktop/xdg_shell.c
@@ -302,8 +302,7 @@ static void handle_commit(struct wl_listener *listener, void *data) {
memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
desktop_damage_view(view);
transaction_commit_dirty();
- transaction_notify_view_ready_by_size(view,
- new_geo.width, new_geo.height);
+ transaction_notify_view_ready_immediately(view);
} else {
memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
}
diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c
index cee0ab10..186502b2 100644
--- a/sway/desktop/xwayland.c
+++ b/sway/desktop/xwayland.c
@@ -401,8 +401,8 @@ static void handle_commit(struct wl_listener *listener, void *data) {
if (view->container->node.instruction) {
get_geometry(view, &view->geometry);
- transaction_notify_view_ready_by_size(view,
- state->width, state->height);
+ transaction_notify_view_ready_by_geometry(view,
+ xsurface->x, xsurface->y, state->width, state->height);
} else {
struct wlr_box new_geo;
get_geometry(view, &new_geo);
@@ -418,8 +418,8 @@ static void handle_commit(struct wl_listener *listener, void *data) {
memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
desktop_damage_view(view);
transaction_commit_dirty();
- transaction_notify_view_ready_by_size(view,
- new_geo.width, new_geo.height);
+ transaction_notify_view_ready_by_geometry(view,
+ xsurface->x, xsurface->y, new_geo.width, new_geo.height);
} else {
memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box));
}