server: add SlideX/Y constraint adjustment to popups

Allows popups that would normally go offscreen to stay visible. X11 doesn't seem
to like windows whose bounds go less than 0x0, so we adjust the position
reported to X11 to make it happy.

I am worried this will have some other implications with popups, but we'll see
what happens.
This commit is contained in:
Shawn Wallace 2025-10-25 15:57:30 -04:00
parent 52cc06e6c6
commit 2dd40ecfe8
3 changed files with 6 additions and 2 deletions

View file

@ -25,6 +25,7 @@ use wayland_protocols::xdg::decoration::zv1::client::zxdg_decoration_manager_v1:
use wayland_protocols::xdg::decoration::zv1::client::zxdg_toplevel_decoration_v1::{
self, ZxdgToplevelDecorationV1,
};
use wayland_protocols::xdg::shell::client::xdg_positioner::ConstraintAdjustment;
use wayland_protocols::{
wp::{
fractional_scale::v1::client::wp_fractional_scale_manager_v1::WpFractionalScaleManagerV1,
@ -1407,6 +1408,8 @@ impl<S: X11Selection + 'static> InnerServerState<S> {
(parent_window.attrs.dims.width as f64 / initial_scale) as i32,
(parent_window.attrs.dims.height as f64 / initial_scale) as i32,
);
positioner
.set_constraint_adjustment(ConstraintAdjustment::SlideX | ConstraintAdjustment::SlideY);
let popup = xdg.get_popup(
Some(&parent_role.xdg().unwrap().surface),
&positioner,