tree/view: Do not clip to geometry if using CSD

If a floating window is using CSD, the geometry should not be used to
define the clipping region. Otherwise drop shadows and such may be
clipped excessively.
master
thal 10 months ago committed by Simon Ser
parent 9704152414
commit a168b20299

@ -927,11 +927,14 @@ void view_update_size(struct sway_view *view) {
void view_center_and_clip_surface(struct sway_view *view) { void view_center_and_clip_surface(struct sway_view *view) {
struct sway_container *con = view->container; struct sway_container *con = view->container;
bool clip_to_geometry = true;
if (container_is_floating(con)) { if (container_is_floating(con)) {
// We always center the current coordinates rather than the next, as the // We always center the current coordinates rather than the next, as the
// geometry immediately affects the currently active rendering. // geometry immediately affects the currently active rendering.
int x = (int) fmax(0, (con->current.content_width - view->geometry.width) / 2); int x = (int) fmax(0, (con->current.content_width - view->geometry.width) / 2);
int y = (int) fmax(0, (con->current.content_height - view->geometry.height) / 2); int y = (int) fmax(0, (con->current.content_height - view->geometry.height) / 2);
clip_to_geometry = !view->using_csd;
wlr_scene_node_set_position(&view->content_tree->node, x, y); wlr_scene_node_set_position(&view->content_tree->node, x, y);
} else { } else {
@ -940,12 +943,16 @@ void view_center_and_clip_surface(struct sway_view *view) {
// only make sure to clip the content if there is content to clip // only make sure to clip the content if there is content to clip
if (!wl_list_empty(&con->view->content_tree->children)) { if (!wl_list_empty(&con->view->content_tree->children)) {
wlr_scene_subsurface_tree_set_clip(&con->view->content_tree->node, &(struct wlr_box){ struct wlr_box clip = {0};
.x = con->view->geometry.x, if (clip_to_geometry) {
.y = con->view->geometry.y, clip = (struct wlr_box){
.width = con->current.content_width, .x = con->view->geometry.x,
.height = con->current.content_height, .y = con->view->geometry.y,
}); .width = con->current.content_width,
.height = con->current.content_height,
};
}
wlr_scene_subsurface_tree_set_clip(&con->view->content_tree->node, &clip);
} }
} }

Loading…
Cancel
Save