diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index b1f3fb326..6c4bd80ec 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c @@ -231,6 +231,13 @@ static void apply_workspace_state(struct sway_workspace *ws, static void apply_container_state(struct sway_container *container, struct sway_container_state *state) { + int tw = 0, th = 0; + struct wlr_texture *texture = config->border_textures.focused.texture; + if (texture) { + tw = texture->width; + th = texture->height; + } + struct sway_view *view = container->view; // Damage the old location desktop_damage_whole_container(container); @@ -238,10 +245,10 @@ static void apply_container_state(struct sway_container *container, struct sway_saved_buffer *saved_buf; wl_list_for_each(saved_buf, &view->saved_buffers, link) { struct wlr_box box = { - .x = saved_buf->x - view->saved_geometry.x, - .y = saved_buf->y - view->saved_geometry.y, - .width = saved_buf->width, - .height = saved_buf->height, + .x = saved_buf->x - view->saved_geometry.x - tw, + .y = saved_buf->y - view->saved_geometry.y - th, + .width = saved_buf->width + 2 * tw, + .height = saved_buf->height + 2 * th, }; desktop_damage_box(&box); } @@ -274,10 +281,10 @@ static void apply_container_state(struct sway_container *container, if (view && view->surface) { struct wlr_surface *surface = view->surface; struct wlr_box box = { - .x = container->current.content_x - view->geometry.x, - .y = container->current.content_y - view->geometry.y, - .width = surface->current.width, - .height = surface->current.height, + .x = container->current.content_x - view->geometry.x - tw, + .y = container->current.content_y - view->geometry.y - th, + .width = surface->current.width + 2 * tw, + .height = surface->current.height + 2 * th, }; desktop_damage_box(&box); } diff --git a/sway/tree/container.c b/sway/tree/container.c index 1e84e6034..ae2d405c3 100644 --- a/sway/tree/container.c +++ b/sway/tree/container.c @@ -559,6 +559,7 @@ static void update_title_texture(struct sway_container *con, output->wlr_output->backend); *texture = wlr_texture_from_pixels( renderer, DRM_FORMAT_ARGB8888, stride, width, height, data); + cairo_surface_destroy(surface); g_object_unref(pango); cairo_destroy(cairo); @@ -1036,6 +1037,14 @@ bool container_has_urgent_child(struct sway_container *container) { return container_find_child(container, find_urgent_iterator, NULL); } +static bool find_focused_iterator(struct sway_container *con, void *data) { + return con->current.focused; +} + +bool container_has_focused_child(struct sway_container *container) { + return container_find_child(container, find_focused_iterator, NULL); +} + void container_end_mouse_operation(struct sway_container *container) { struct sway_seat *seat; wl_list_for_each(seat, &server.input->seats, link) {