aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLibravatar thal <thal@users.noreply.github.com>2024-03-02 17:17:51 -0600
committerLibravatar Simon Ser <contact@emersion.fr>2024-05-24 00:18:44 +0200
commita168b2029932d2a76341d91b3c6d8463de568213 (patch)
tree9b761719de8ff276e00f417fbeb0c430edee5249
parentbuild: drop xwayland option (diff)
downloadsway-a168b2029932d2a76341d91b3c6d8463de568213.tar.gz
sway-a168b2029932d2a76341d91b3c6d8463de568213.tar.zst
sway-a168b2029932d2a76341d91b3c6d8463de568213.zip
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) {
927void view_center_and_clip_surface(struct sway_view *view) { 927void view_center_and_clip_surface(struct sway_view *view) {
928 struct sway_container *con = view->container; 928 struct sway_container *con = view->container;
929 929
930 bool clip_to_geometry = true;
931
930 if (container_is_floating(con)) { 932 if (container_is_floating(con)) {
931 // We always center the current coordinates rather than the next, as the 933 // We always center the current coordinates rather than the next, as the
932 // geometry immediately affects the currently active rendering. 934 // geometry immediately affects the currently active rendering.
933 int x = (int) fmax(0, (con->current.content_width - view->geometry.width) / 2); 935 int x = (int) fmax(0, (con->current.content_width - view->geometry.width) / 2);
934 int y = (int) fmax(0, (con->current.content_height - view->geometry.height) / 2); 936 int y = (int) fmax(0, (con->current.content_height - view->geometry.height) / 2);
937 clip_to_geometry = !view->using_csd;
935 938
936 wlr_scene_node_set_position(&view->content_tree->node, x, y); 939 wlr_scene_node_set_position(&view->content_tree->node, x, y);
937 } else { 940 } else {
@@ -940,12 +943,16 @@ void view_center_and_clip_surface(struct sway_view *view) {
940 943
941 // only make sure to clip the content if there is content to clip 944 // only make sure to clip the content if there is content to clip
942 if (!wl_list_empty(&con->view->content_tree->children)) { 945 if (!wl_list_empty(&con->view->content_tree->children)) {
943 wlr_scene_subsurface_tree_set_clip(&con->view->content_tree->node, &(struct wlr_box){ 946 struct wlr_box clip = {0};
944 .x = con->view->geometry.x, 947 if (clip_to_geometry) {
945 .y = con->view->geometry.y, 948 clip = (struct wlr_box){
946 .width = con->current.content_width, 949 .x = con->view->geometry.x,
947 .height = con->current.content_height, 950 .y = con->view->geometry.y,
948 }); 951 .width = con->current.content_width,
952 .height = con->current.content_height,
953 };
954 }
955 wlr_scene_subsurface_tree_set_clip(&con->view->content_tree->node, &clip);
949 } 956 }
950} 957}
951 958