From d245e283e14b20af7a83938eadb315035b5921cf Mon Sep 17 00:00:00 2001 From: Leonhard Kargl Date: Sat, 31 May 2025 10:15:53 +0200 Subject: [PATCH 1/2] ShellWindow: Clip window actor when applying translations --- src/ShellClients/ShellWindow.vala | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/ShellClients/ShellWindow.vala b/src/ShellClients/ShellWindow.vala index 7eba7d952..6cd082b75 100644 --- a/src/ShellClients/ShellWindow.vala +++ b/src/ShellClients/ShellWindow.vala @@ -24,6 +24,11 @@ public class Gala.ShellWindow : PositionedWindow, GestureTarget { construct { window_actor = (Meta.WindowActor) window.get_compositor_private (); + window_actor.notify["width"].connect (update_clip); + window_actor.notify["height"].connect (update_clip); + window_actor.notify["translation-y"].connect (update_clip); + notify["position"].connect (update_clip); + window_actor.notify["height"].connect (update_target); notify["position"].connect (update_target); update_target (); @@ -140,4 +145,20 @@ public class Gala.ShellWindow : PositionedWindow, GestureTarget { return hidden ? 0u : 255u; } } + + private void update_clip () { + switch (position) { + case TOP: + window_actor.set_clip (0, -window_actor.translation_y, window_actor.width, window_actor.height + window_actor.translation_y); + break; + + case BOTTOM: + window_actor.set_clip (0, 0, window_actor.width, window_actor.height - window_actor.translation_y); + break; + + default: + window_actor.remove_clip (); + break; + } + } } From 83c3ba5ce70082d40a442f243cc9ac47161d8eef Mon Sep 17 00:00:00 2001 From: Leonhard Kargl Date: Mon, 2 Jun 2025 19:42:57 +0200 Subject: [PATCH 2/2] Actually clip to monitor, dont just offset translation --- src/ShellClients/ShellWindow.vala | 21 +++++++++++---------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/src/ShellClients/ShellWindow.vala b/src/ShellClients/ShellWindow.vala index 6cd082b75..fe5c968f7 100644 --- a/src/ShellClients/ShellWindow.vala +++ b/src/ShellClients/ShellWindow.vala @@ -147,18 +147,19 @@ public class Gala.ShellWindow : PositionedWindow, GestureTarget { } private void update_clip () { - switch (position) { - case TOP: - window_actor.set_clip (0, -window_actor.translation_y, window_actor.width, window_actor.height + window_actor.translation_y); - break; + if (position != TOP && position != BOTTOM) { + window_actor.remove_clip (); + return; + } - case BOTTOM: - window_actor.set_clip (0, 0, window_actor.width, window_actor.height - window_actor.translation_y); - break; + var monitor_geom = window.display.get_monitor_geometry (window.get_monitor ()); - default: - window_actor.remove_clip (); - break; + var y = window_actor.y + window_actor.translation_y; + + if (y + window_actor.height > monitor_geom.y + monitor_geom.height) { + window_actor.set_clip (0, 0, window_actor.width, monitor_geom.y + monitor_geom.height - y); + } else if (y < monitor_geom.y) { + window_actor.set_clip (0, monitor_geom.y - y, window_actor.width, window_actor.height); } } }