diff options
-rw-r--r-- | include/sway/desktop/transaction.h | 12 | ||||
-rw-r--r-- | sway/desktop/transaction.c | 14 | ||||
-rw-r--r-- | sway/desktop/xdg_shell.c | 3 | ||||
-rw-r--r-- | sway/desktop/xwayland.c | 8 |
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, | |||
38 | 38 | ||
39 | /** | 39 | /** |
40 | * Notify the transaction system that a view is ready for the new layout, but | 40 | * Notify the transaction system that a view is ready for the new layout, but |
41 | * identifying the instruction by width and height rather than by serial. | 41 | * identifying the instruction by geometry rather than by serial. |
42 | * | 42 | * |
43 | * This is used by xwayland views, as they don't have serials. | 43 | * This is used by xwayland views, as they don't have serials. |
44 | */ | 44 | */ |
45 | void transaction_notify_view_ready_by_size(struct sway_view *view, | 45 | void transaction_notify_view_ready_by_geometry(struct sway_view *view, |
46 | int width, int height); | 46 | double x, double y, int width, int height); |
47 | |||
48 | /** | ||
49 | * Unconditionally notify the transaction system that a view is ready for the | ||
50 | * new layout. | ||
51 | */ | ||
52 | void transaction_notify_view_ready_immediately(struct sway_view *view); | ||
47 | 53 | ||
48 | #endif | 54 | #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, | |||
510 | } | 510 | } |
511 | } | 511 | } |
512 | 512 | ||
513 | void transaction_notify_view_ready_by_size(struct sway_view *view, | 513 | void transaction_notify_view_ready_by_geometry(struct sway_view *view, |
514 | int width, int height) { | 514 | double x, double y, int width, int height) { |
515 | struct sway_transaction_instruction *instruction = | 515 | struct sway_transaction_instruction *instruction = |
516 | view->container->node.instruction; | 516 | view->container->node.instruction; |
517 | if (instruction != NULL && | 517 | if (instruction != NULL && |
518 | (int)instruction->container_state.content_x == (int)x && | ||
519 | (int)instruction->container_state.content_y == (int)y && | ||
518 | instruction->container_state.content_width == width && | 520 | instruction->container_state.content_width == width && |
519 | instruction->container_state.content_height == height) { | 521 | instruction->container_state.content_height == height) { |
520 | set_instruction_ready(instruction); | 522 | set_instruction_ready(instruction); |
521 | } | 523 | } |
522 | } | 524 | } |
523 | 525 | ||
526 | void transaction_notify_view_ready_immediately(struct sway_view *view) { | ||
527 | struct sway_transaction_instruction *instruction = | ||
528 | view->container->node.instruction; | ||
529 | if (instruction != NULL) { | ||
530 | set_instruction_ready(instruction); | ||
531 | } | ||
532 | } | ||
533 | |||
524 | void transaction_commit_dirty(void) { | 534 | void transaction_commit_dirty(void) { |
525 | if (!server.dirty_nodes->length) { | 535 | if (!server.dirty_nodes->length) { |
526 | return; | 536 | 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) { | |||
302 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); | 302 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); |
303 | desktop_damage_view(view); | 303 | desktop_damage_view(view); |
304 | transaction_commit_dirty(); | 304 | transaction_commit_dirty(); |
305 | transaction_notify_view_ready_by_size(view, | 305 | transaction_notify_view_ready_immediately(view); |
306 | new_geo.width, new_geo.height); | ||
307 | } else { | 306 | } else { |
308 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); | 307 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); |
309 | } | 308 | } |
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) { | |||
401 | 401 | ||
402 | if (view->container->node.instruction) { | 402 | if (view->container->node.instruction) { |
403 | get_geometry(view, &view->geometry); | 403 | get_geometry(view, &view->geometry); |
404 | transaction_notify_view_ready_by_size(view, | 404 | transaction_notify_view_ready_by_geometry(view, |
405 | state->width, state->height); | 405 | xsurface->x, xsurface->y, state->width, state->height); |
406 | } else { | 406 | } else { |
407 | struct wlr_box new_geo; | 407 | struct wlr_box new_geo; |
408 | get_geometry(view, &new_geo); | 408 | get_geometry(view, &new_geo); |
@@ -418,8 +418,8 @@ static void handle_commit(struct wl_listener *listener, void *data) { | |||
418 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); | 418 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); |
419 | desktop_damage_view(view); | 419 | desktop_damage_view(view); |
420 | transaction_commit_dirty(); | 420 | transaction_commit_dirty(); |
421 | transaction_notify_view_ready_by_size(view, | 421 | transaction_notify_view_ready_by_geometry(view, |
422 | new_geo.width, new_geo.height); | 422 | xsurface->x, xsurface->y, new_geo.width, new_geo.height); |
423 | } else { | 423 | } else { |
424 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); | 424 | memcpy(&view->geometry, &new_geo, sizeof(struct wlr_box)); |
425 | } | 425 | } |