Use view dimensions for windows instead of surface dimensions (#94)
This commit is contained in:
parent
dd67fdb6c3
commit
8f8a5c0492
1 changed files with 27 additions and 22 deletions
|
@ -173,7 +173,10 @@ static void render_surface_iterator(struct sway_output *output,
|
||||||
if (clip_box != NULL) {
|
if (clip_box != NULL) {
|
||||||
dst_box.width = fmin(dst_box.width, clip_box->width);
|
dst_box.width = fmin(dst_box.width, clip_box->width);
|
||||||
dst_box.height = fmin(dst_box.height, clip_box->height);
|
dst_box.height = fmin(dst_box.height, clip_box->height);
|
||||||
|
dst_box.x = fmax(dst_box.x, clip_box->x);
|
||||||
|
dst_box.y = fmax(dst_box.y, clip_box->y);
|
||||||
}
|
}
|
||||||
|
|
||||||
scale_box(&dst_box, wlr_output->scale);
|
scale_box(&dst_box, wlr_output->scale);
|
||||||
|
|
||||||
data->deco_data.corner_radius *= wlr_output->scale;
|
data->deco_data.corner_radius *= wlr_output->scale;
|
||||||
|
@ -382,21 +385,22 @@ static void render_view_toplevels(struct sway_view *view, struct sway_output *ou
|
||||||
.damage = damage,
|
.damage = damage,
|
||||||
.deco_data = deco_data,
|
.deco_data = deco_data,
|
||||||
};
|
};
|
||||||
|
// Clip the window to its view size, ignoring CSD
|
||||||
struct wlr_box clip_box;
|
struct wlr_box clip_box;
|
||||||
if (!container_is_current_floating(view->container)) {
|
struct sway_container_state state = view->container->current;
|
||||||
// As we pass the geometry offsets to the surface iterator, we will
|
clip_box.x = state.x - output->lx;
|
||||||
// need to account for the offsets in the clip dimensions.
|
clip_box.y = state.y - output->ly;
|
||||||
clip_box.width = view->container->current.content_width + view->geometry.x;
|
clip_box.width = state.width;
|
||||||
clip_box.height = view->container->current.content_height + view->geometry.y;
|
clip_box.height = state.height;
|
||||||
data.clip_box = &clip_box;
|
if (state.border == B_PIXEL || state.border == B_NORMAL) {
|
||||||
|
clip_box.x += state.border_thickness;
|
||||||
|
clip_box.y += state.border_thickness;
|
||||||
|
clip_box.width -= state.border_thickness * 2;
|
||||||
|
clip_box.height -= state.border_thickness * 2;
|
||||||
}
|
}
|
||||||
// Render all toplevels without descending into popups
|
data.clip_box = &clip_box;
|
||||||
double ox = view->container->surface_x -
|
|
||||||
output->lx - view->geometry.x;
|
output_view_for_each_surface(output, view, render_surface_iterator, &data);
|
||||||
double oy = view->container->surface_y -
|
|
||||||
output->ly - view->geometry.y;
|
|
||||||
output_surface_for_each_surface(output, view->surface, ox, oy,
|
|
||||||
render_surface_iterator, &data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static void render_view_popups(struct sway_view *view, struct sway_output *output,
|
static void render_view_popups(struct sway_view *view, struct sway_output *output,
|
||||||
|
@ -417,8 +421,6 @@ static void render_saved_view(struct sway_view *view, struct sway_output *output
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool floating = container_is_current_floating(view->container);
|
|
||||||
|
|
||||||
struct sway_saved_buffer *saved_buf;
|
struct sway_saved_buffer *saved_buf;
|
||||||
wl_list_for_each(saved_buf, &view->saved_buffers, link) {
|
wl_list_for_each(saved_buf, &view->saved_buffers, link) {
|
||||||
if (!saved_buf->buffer->texture) {
|
if (!saved_buf->buffer->texture) {
|
||||||
|
@ -451,13 +453,16 @@ static void render_saved_view(struct sway_view *view, struct sway_output *output
|
||||||
wlr_matrix_project_box(matrix, &proj_box, transform, 0,
|
wlr_matrix_project_box(matrix, &proj_box, transform, 0,
|
||||||
wlr_output->transform_matrix);
|
wlr_output->transform_matrix);
|
||||||
|
|
||||||
if (!floating) {
|
struct sway_container_state state = view->container->current;
|
||||||
dst_box.width = fmin(dst_box.width,
|
dst_box.x = state.x - output->lx;
|
||||||
view->container->current.content_width -
|
dst_box.y = state.y - output->ly;
|
||||||
(saved_buf->x - view->container->current.content_x) + view->saved_geometry.x);
|
dst_box.width = state.width;
|
||||||
dst_box.height = fmin(dst_box.height,
|
dst_box.height = state.height;
|
||||||
view->container->current.content_height -
|
if (state.border == B_PIXEL || state.border == B_NORMAL) {
|
||||||
(saved_buf->y - view->container->current.content_y) + view->saved_geometry.y);
|
dst_box.x += state.border_thickness;
|
||||||
|
dst_box.y += state.border_thickness;
|
||||||
|
dst_box.width -= state.border_thickness * 2;
|
||||||
|
dst_box.height -= state.border_thickness * 2;
|
||||||
}
|
}
|
||||||
scale_box(&dst_box, wlr_output->scale);
|
scale_box(&dst_box, wlr_output->scale);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue