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:
parent
52cc06e6c6
commit
2dd40ecfe8
3 changed files with 6 additions and 2 deletions
|
|
@ -227,8 +227,8 @@ impl SurfaceEvents {
|
|||
let (scale_factor, window, window_data) = query.get().unwrap();
|
||||
|
||||
let window = *window;
|
||||
let x = (pending.x as f64 * scale_factor.0) as i32 + window_data.output_offset.x;
|
||||
let y = (pending.y as f64 * scale_factor.0) as i32 + window_data.output_offset.y;
|
||||
let x = (pending.x.max(0) as f64 * scale_factor.0) as i32 + window_data.output_offset.x;
|
||||
let y = (pending.y.max(0) as f64 * scale_factor.0) as i32 + window_data.output_offset.y;
|
||||
let width = if pending.width > 0 {
|
||||
(pending.width as f64 * scale_factor.0) as u16
|
||||
} else {
|
||||
|
|
|
|||
|
|
@ -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,
|
||||
|
|
|
|||
|
|
@ -1740,6 +1740,7 @@ impl Dispatch<XdgPositioner, ()> for State {
|
|||
xdg_positioner::Request::Destroy => {
|
||||
data.remove();
|
||||
}
|
||||
xdg_positioner::Request::SetConstraintAdjustment { .. } => {}
|
||||
other => todo!("unhandled positioner request {other:?}"),
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue