diff options
Diffstat (limited to 'sway/desktop')
-rw-r--r-- | sway/desktop/desktop.c | 4 | ||||
-rw-r--r-- | sway/desktop/output.c | 39 | ||||
-rw-r--r-- | sway/desktop/render.c | 57 | ||||
-rw-r--r-- | sway/desktop/transaction.c | 50 | ||||
-rw-r--r-- | sway/desktop/xdg_shell.c | 10 | ||||
-rw-r--r-- | sway/desktop/xdg_shell_v6.c | 10 | ||||
-rw-r--r-- | sway/desktop/xwayland.c | 18 |
7 files changed, 92 insertions, 96 deletions
diff --git a/sway/desktop/desktop.c b/sway/desktop/desktop.c index 771b58fe..d8dd0240 100644 --- a/sway/desktop/desktop.c +++ b/sway/desktop/desktop.c @@ -28,8 +28,8 @@ void desktop_damage_box(struct wlr_box *box) { void desktop_damage_view(struct sway_view *view) { desktop_damage_whole_container(view->container); struct wlr_box box = { - .x = view->container->current.view_x - view->geometry.x, - .y = view->container->current.view_y - view->geometry.y, + .x = view->container->current.content_x - view->geometry.x, + .y = view->container->current.content_y - view->geometry.y, .width = view->surface->current.width, .height = view->surface->current.height, }; diff --git a/sway/desktop/output.c b/sway/desktop/output.c index d48ddef3..d649100f 100644 --- a/sway/desktop/output.c +++ b/sway/desktop/output.c @@ -160,12 +160,12 @@ void output_view_for_each_surface(struct sway_output *output, .user_iterator = iterator, .user_data = user_data, .output = output, - .ox = view->container->current.view_x - output->wlr_output->lx + .ox = view->container->current.content_x - output->wlr_output->lx - view->geometry.x, - .oy = view->container->current.view_y - output->wlr_output->ly + .oy = view->container->current.content_y - output->wlr_output->ly - view->geometry.y, - .width = view->container->current.view_width, - .height = view->container->current.view_height, + .width = view->container->current.content_width, + .height = view->container->current.content_height, .rotation = 0, // TODO }; @@ -179,12 +179,12 @@ void output_view_for_each_popup(struct sway_output *output, .user_iterator = iterator, .user_data = user_data, .output = output, - .ox = view->container->current.view_x - output->wlr_output->lx + .ox = view->container->current.content_x - output->wlr_output->lx - view->geometry.x, - .oy = view->container->current.view_y - output->wlr_output->ly + .oy = view->container->current.content_y - output->wlr_output->ly - view->geometry.y, - .width = view->container->current.view_width, - .height = view->container->current.view_height, + .width = view->container->current.content_width, + .height = view->container->current.content_height, .rotation = 0, // TODO }; @@ -204,7 +204,7 @@ void output_layer_for_each_surface(struct sway_output *output, } } -#ifdef HAVE_XWAYLAND +#if HAVE_XWAYLAND void output_unmanaged_for_each_surface(struct sway_output *output, struct wl_list *unmanaged, sway_surface_iterator_func_t iterator, void *user_data) { @@ -274,7 +274,7 @@ static void output_for_each_surface(struct sway_output *output, for_each_surface_container_iterator(floater, &data); } } -#ifdef HAVE_XWAYLAND +#if HAVE_XWAYLAND output_unmanaged_for_each_surface(output, &root->xwayland_unmanaged, iterator, user_data); #endif @@ -289,7 +289,7 @@ static void output_for_each_surface(struct sway_output *output, workspace_for_each_container(workspace, for_each_surface_container_iterator, &data); -#ifdef HAVE_XWAYLAND +#if HAVE_XWAYLAND output_unmanaged_for_each_surface(output, &root->xwayland_unmanaged, iterator, user_data); #endif @@ -469,23 +469,14 @@ void output_damage_box(struct sway_output *output, struct wlr_box *_box) { wlr_output_damage_add_box(output->damage, &box); } -static void output_damage_whole_container_iterator(struct sway_container *con, - void *data) { - if (!sway_assert(con->view, "expected a view")) { - return; - } - struct sway_output *output = data; - output_damage_view(output, con->view, true); -} - void output_damage_whole_container(struct sway_output *output, struct sway_container *con) { // Pad the box by 1px, because the width is a double and might be a fraction struct wlr_box box = { - .x = con->current.con_x - output->wlr_output->lx - 1, - .y = con->current.con_y - output->wlr_output->ly - 1, - .width = con->current.con_width + 2, - .height = con->current.con_height + 2, + .x = con->current.x - output->wlr_output->lx - 1, + .y = con->current.y - output->wlr_output->ly - 1, + .width = con->current.width + 2, + .height = con->current.height + 2, }; scale_box(&box, output->wlr_output->scale); wlr_output_damage_add_box(output->damage, &box); diff --git a/sway/desktop/render.c b/sway/desktop/render.c index cf6da682..8d4a701b 100644 --- a/sway/desktop/render.c +++ b/sway/desktop/render.c @@ -140,7 +140,7 @@ static void render_layer(struct sway_output *output, render_surface_iterator, &data); } -#ifdef HAVE_XWAYLAND +#if HAVE_XWAYLAND static void render_unmanaged(struct sway_output *output, pixman_region32_t *damage, struct wl_list *unmanaged) { struct render_data data = { @@ -211,9 +211,9 @@ static void render_view_toplevels(struct sway_view *view, .alpha = alpha, }; // Render all toplevels without descending into popups - double ox = view->container->current.view_x - + double ox = view->container->current.content_x - output->wlr_output->lx - view->geometry.x; - double oy = view->container->current.view_y - + double oy = view->container->current.content_y - output->wlr_output->ly - view->geometry.y; output_surface_for_each_surface(output, view->surface, ox, oy, render_surface_iterator, &data); @@ -247,9 +247,9 @@ static void render_saved_view(struct sway_view *view, return; } struct wlr_box box = { - .x = view->container->current.view_x - output->wlr_output->lx - + .x = view->container->current.content_x - output->wlr_output->lx - view->saved_geometry.x, - .y = view->container->current.view_y - output->wlr_output->ly - + .y = view->container->current.content_y - output->wlr_output->ly - view->saved_geometry.y, .width = view->saved_buffer_width, .height = view->saved_buffer_height, @@ -300,10 +300,10 @@ static void render_view(struct sway_output *output, pixman_region32_t *damage, if (state->border_left) { memcpy(&color, colors->child_border, sizeof(float) * 4); premultiply_alpha(color, con->alpha); - box.x = state->con_x; - box.y = state->view_y; + box.x = state->x; + box.y = state->content_y; box.width = state->border_thickness; - box.height = state->view_height; + box.height = state->content_height; scale_box(&box, output_scale); render_rect(output->wlr_output, damage, &box, color); } @@ -319,10 +319,10 @@ static void render_view(struct sway_output *output, pixman_region32_t *damage, memcpy(&color, colors->child_border, sizeof(float) * 4); } premultiply_alpha(color, con->alpha); - box.x = state->view_x + state->view_width; - box.y = state->view_y; + box.x = state->content_x + state->content_width; + box.y = state->content_y; box.width = state->border_thickness; - box.height = state->view_height; + box.height = state->content_height; scale_box(&box, output_scale); render_rect(output->wlr_output, damage, &box, color); } @@ -334,9 +334,9 @@ static void render_view(struct sway_output *output, pixman_region32_t *damage, memcpy(&color, colors->child_border, sizeof(float) * 4); } premultiply_alpha(color, con->alpha); - box.x = state->con_x; - box.y = state->view_y + state->view_height; - box.width = state->con_width; + box.x = state->x; + box.y = state->content_y + state->content_height; + box.width = state->width; box.height = state->border_thickness; scale_box(&box, output_scale); render_rect(output->wlr_output, damage, &box, color); @@ -585,9 +585,9 @@ static void render_top_border(struct sway_output *output, // Child border - top edge memcpy(&color, colors->child_border, sizeof(float) * 4); premultiply_alpha(color, con->alpha); - box.x = state->con_x; - box.y = state->con_y; - box.width = state->con_width; + box.x = state->x; + box.y = state->y; + box.width = state->width; box.height = state->border_thickness; scale_box(&box, output_scale); render_rect(output->wlr_output, output_damage, &box, color); @@ -641,8 +641,8 @@ static void render_containers_linear(struct sway_output *output, } if (state->border == B_NORMAL) { - render_titlebar(output, damage, child, state->con_x, - state->con_y, state->con_width, colors, + render_titlebar(output, damage, child, state->x, + state->y, state->width, colors, title_texture, marks_texture); } else if (state->border == B_PIXEL) { render_top_border(output, damage, child, colors); @@ -696,7 +696,7 @@ static void render_containers_tabbed(struct sway_output *output, marks_texture = child->marks_unfocused; } - int x = cstate->con_x + tab_width * i; + int x = cstate->x + tab_width * i; // Make last tab use the remaining width of the parent if (i == parent->children->length - 1) { @@ -801,10 +801,10 @@ static void render_container(struct sway_output *output, struct parent_data data = { .layout = con->current.layout, .box = { - .x = con->current.con_x, - .y = con->current.con_y, - .width = con->current.con_width, - .height = con->current.con_height, + .x = con->current.x, + .y = con->current.y, + .width = con->current.width, + .height = con->current.height, }, .children = con->current.children, .focused = focused, @@ -853,8 +853,8 @@ static void render_floating_container(struct sway_output *soutput, } if (con->current.border == B_NORMAL) { - render_titlebar(soutput, damage, con, con->current.con_x, - con->current.con_y, con->current.con_width, colors, + render_titlebar(soutput, damage, con, con->current.x, + con->current.y, con->current.width, colors, title_texture, marks_texture); } else if (con->current.border == B_PIXEL) { render_top_border(soutput, damage, con, colors); @@ -966,7 +966,7 @@ void output_render(struct sway_output *output, struct timespec *when, render_floating_container(output, damage, floater); } } -#ifdef HAVE_XWAYLAND +#if HAVE_XWAYLAND render_unmanaged(output, damage, &root->xwayland_unmanaged); #endif } else { @@ -986,7 +986,7 @@ void output_render(struct sway_output *output, struct timespec *when, render_workspace(output, damage, workspace, workspace->current.focused); render_floating(output, damage); -#ifdef HAVE_XWAYLAND +#if HAVE_XWAYLAND render_unmanaged(output, damage, &root->xwayland_unmanaged); #endif render_layer(output, damage, @@ -1019,6 +1019,7 @@ renderer_end: } wlr_renderer_scissor(renderer, NULL); + wlr_output_render_software_cursors(wlr_output, damage); wlr_renderer_end(renderer); if (!wlr_output_damage_swap_buffers(output->damage, when, damage)) { return; diff --git a/sway/desktop/transaction.c b/sway/desktop/transaction.c index 44156d41..bf0038b4 100644 --- a/sway/desktop/transaction.c +++ b/sway/desktop/transaction.c @@ -130,10 +130,10 @@ static void copy_container_state(struct sway_container *container, struct sway_container_state *state = &instruction->container_state; state->layout = container->layout; - state->con_x = container->x; - state->con_y = container->y; - state->con_width = container->width; - state->con_height = container->height; + state->x = container->x; + state->y = container->y; + state->width = container->width; + state->height = container->height; state->is_fullscreen = container->is_fullscreen; state->parent = container->parent; state->workspace = container->workspace; @@ -143,14 +143,12 @@ static void copy_container_state(struct sway_container *container, state->border_left = container->border_left; state->border_right = container->border_right; state->border_bottom = container->border_bottom; + state->content_x = container->content_x; + state->content_y = container->content_y; + state->content_width = container->content_width; + state->content_height = container->content_height; - if (container->view) { - struct sway_view *view = container->view; - state->view_x = view->x; - state->view_y = view->y; - state->view_width = view->width; - state->view_height = view->height; - } else { + if (!container->view) { state->children = create_list(); list_cat(state->children, container->children); } @@ -217,8 +215,8 @@ static void apply_container_state(struct sway_container *container, desktop_damage_whole_container(container); if (view && view->saved_buffer) { struct wlr_box box = { - .x = container->current.view_x - view->saved_geometry.x, - .y = container->current.view_y - view->saved_geometry.y, + .x = container->current.content_x - view->saved_geometry.x, + .y = container->current.content_y - view->saved_geometry.y, .width = view->saved_buffer_width, .height = view->saved_buffer_height, }; @@ -245,8 +243,8 @@ 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.view_x - view->geometry.x, - .y = container->current.view_y - view->geometry.y, + .x = container->current.content_x - view->geometry.x, + .y = container->current.content_y - view->geometry.y, .width = surface->current.width, .height = surface->current.height, }; @@ -382,18 +380,18 @@ static bool should_configure(struct sway_node *node, } struct sway_container_state *cstate = &node->sway_container->current; struct sway_container_state *istate = &instruction->container_state; -#ifdef HAVE_XWAYLAND +#if HAVE_XWAYLAND // Xwayland views are position-aware and need to be reconfigured // when their position changes. if (node->sway_container->view->type == SWAY_VIEW_XWAYLAND) { - if (cstate->view_x != istate->view_x || - cstate->view_y != istate->view_y) { + if (cstate->content_x != istate->content_x || + cstate->content_y != istate->content_y) { return true; } } #endif - if (cstate->view_width == istate->view_width && - cstate->view_height == istate->view_height) { + if (cstate->content_width == istate->content_width && + cstate->content_height == istate->content_height) { return false; } return true; @@ -409,10 +407,10 @@ static void transaction_commit(struct sway_transaction *transaction) { struct sway_node *node = instruction->node; if (should_configure(node, instruction)) { instruction->serial = view_configure(node->sway_container->view, - instruction->container_state.view_x, - instruction->container_state.view_y, - instruction->container_state.view_width, - instruction->container_state.view_height); + instruction->container_state.content_x, + instruction->container_state.content_y, + instruction->container_state.content_width, + instruction->container_state.content_height); ++transaction->num_waiting; // From here on we are rendering a saved buffer of the view, which @@ -504,8 +502,8 @@ void transaction_notify_view_ready_by_size(struct sway_view *view, int width, int height) { struct sway_transaction_instruction *instruction = view->container->node.instruction; - if (instruction->container_state.view_width == width && - instruction->container_state.view_height == height) { + if (instruction->container_state.content_width == width && + instruction->container_state.content_height == height) { set_instruction_ready(instruction); } } diff --git a/sway/desktop/xdg_shell.c b/sway/desktop/xdg_shell.c index 0b2ebc96..801dcee0 100644 --- a/sway/desktop/xdg_shell.c +++ b/sway/desktop/xdg_shell.c @@ -75,8 +75,8 @@ static void popup_unconstrain(struct sway_xdg_popup *popup) { // the output box expressed in the coordinate system of the toplevel parent // of the popup struct wlr_box output_toplevel_sx_box = { - .x = output->lx - view->x, - .y = output->ly - view->y, + .x = output->lx - view->container->content_x, + .y = output->ly - view->container->content_y, .width = output->width, .height = output->height, }; @@ -286,9 +286,11 @@ static void handle_commit(struct wl_listener *listener, void *data) { } else { struct wlr_box new_geo; wlr_xdg_surface_get_geometry(xdg_surface, &new_geo); + struct sway_container *con = view->container; - if ((new_geo.width != view->width || new_geo.height != view->height) && - container_is_floating(view->container)) { + if ((new_geo.width != con->content_width || + new_geo.height != con->content_height) && + container_is_floating(con)) { // A floating view has unexpectedly sent a new size desktop_damage_view(view); view_update_size(view, new_geo.width, new_geo.height); diff --git a/sway/desktop/xdg_shell_v6.c b/sway/desktop/xdg_shell_v6.c index 692cfbf5..4bc83b8e 100644 --- a/sway/desktop/xdg_shell_v6.c +++ b/sway/desktop/xdg_shell_v6.c @@ -74,8 +74,8 @@ static void popup_unconstrain(struct sway_xdg_popup_v6 *popup) { // the output box expressed in the coordinate system of the toplevel parent // of the popup struct wlr_box output_toplevel_sx_box = { - .x = output->lx - view->x, - .y = output->ly - view->y, + .x = output->lx - view->container->content_x, + .y = output->ly - view->container->content_y, .width = output->width, .height = output->height, }; @@ -283,9 +283,11 @@ static void handle_commit(struct wl_listener *listener, void *data) { } else { struct wlr_box new_geo; wlr_xdg_surface_v6_get_geometry(xdg_surface_v6, &new_geo); + struct sway_container *con = view->container; - if ((new_geo.width != view->width || new_geo.height != view->height) && - container_is_floating(view->container)) { + if ((new_geo.width != con->content_width || + new_geo.height != con->content_height) && + container_is_floating(con)) { // A floating view has unexpectedly sent a new size desktop_damage_view(view); view_update_size(view, new_geo.width, new_geo.height); diff --git a/sway/desktop/xwayland.c b/sway/desktop/xwayland.c index 0c41d960..1838ad32 100644 --- a/sway/desktop/xwayland.c +++ b/sway/desktop/xwayland.c @@ -332,9 +332,11 @@ static void handle_commit(struct wl_listener *listener, void *data) { } else { struct wlr_box new_geo; get_geometry(view, &new_geo); + struct sway_container *con = view->container; - if ((new_geo.width != view->width || new_geo.height != view->height) && - container_is_floating(view->container)) { + if ((new_geo.width != con->content_width || + new_geo.height != con->content_height) && + container_is_floating(con)) { // A floating view has unexpectedly sent a new size // eg. The Firefox "Save As" dialog when downloading a file desktop_damage_view(view); @@ -432,13 +434,13 @@ static void handle_request_configure(struct wl_listener *listener, void *data) { return; } if (container_is_floating(view->container)) { - configure(view, view->container->current.view_x, - view->container->current.view_y, ev->width, ev->height); + configure(view, view->container->current.content_x, + view->container->current.content_y, ev->width, ev->height); } else { - configure(view, view->container->current.view_x, - view->container->current.view_y, - view->container->current.view_width, - view->container->current.view_height); + configure(view, view->container->current.content_x, + view->container->current.content_y, + view->container->current.content_width, + view->container->current.content_height); } } |