aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFurkan Sahin <furkan-dev@proton.me>2024-03-02 17:17:51 -0600
committerFurkan Sahin <furkan-dev@proton.me>2024-03-02 17:17:51 -0600
commit7532e46a795af39d97e9f70df7d0add617a6b2d5 (patch)
tree9b761719de8ff276e00f417fbeb0c430edee5249
parent4c79614f5eebef14df87b231acb867f8da1220db (diff)
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.
-rw-r--r--sway/tree/view.c19
1 files changed, 13 insertions, 6 deletions
diff --git a/sway/tree/view.c b/sway/tree/view.c
index 9a87d9e2..1c1c8ee8 100644
--- a/sway/tree/view.c
+++ b/sway/tree/view.c
@@ -927,11 +927,14 @@ void view_update_size(struct sway_view *view) {
void view_center_and_clip_surface(struct sway_view *view) {
struct sway_container *con = view->container;
+ bool clip_to_geometry = true;
+
if (container_is_floating(con)) {
// We always center the current coordinates rather than the next, as the
// geometry immediately affects the currently active rendering.
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);
+ clip_to_geometry = !view->using_csd;
wlr_scene_node_set_position(&view->content_tree->node, x, y);
} 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
if (!wl_list_empty(&con->view->content_tree->children)) {
- wlr_scene_subsurface_tree_set_clip(&con->view->content_tree->node, &(struct wlr_box){
- .x = con->view->geometry.x,
- .y = con->view->geometry.y,
- .width = con->current.content_width,
- .height = con->current.content_height,
- });
+ struct wlr_box clip = {0};
+ if (clip_to_geometry) {
+ clip = (struct wlr_box){
+ .x = con->view->geometry.x,
+ .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);
}
}