XdgPopup: fix unconstrain from box coords
We currently don't properly handle xdg surface geometry of the parent, which causes popups to render partially off-screen in some cases. GTK4 clients such as easyeffects seem to trigger this issue reliably.
This commit is contained in:
parent
0c3a581f54
commit
c9fd8b3f37
@ -54,25 +54,31 @@ pub fn create(wlr_xdg_popup: *wlr.XdgPopup, parent: Parent) void {
|
|||||||
assert(wlr_xdg_popup.base.data == 0);
|
assert(wlr_xdg_popup.base.data == 0);
|
||||||
wlr_xdg_popup.base.data = @ptrToInt(xdg_popup);
|
wlr_xdg_popup.base.data = @ptrToInt(xdg_popup);
|
||||||
|
|
||||||
const parent_box = switch (parent) {
|
switch (parent) {
|
||||||
.xdg_toplevel => |xdg_toplevel| &xdg_toplevel.view.pending.box,
|
.xdg_toplevel => |xdg_toplevel| {
|
||||||
.layer_surface => |layer_surface| &layer_surface.box,
|
const output_dimensions = xdg_toplevel.view.output.getEffectiveResolution();
|
||||||
|
// The output box relative to the parent of the xdg_popup
|
||||||
|
var box = wlr.Box{
|
||||||
|
.x = xdg_toplevel.view.surface_box.x - xdg_toplevel.view.pending.box.x,
|
||||||
|
.y = xdg_toplevel.view.surface_box.y - xdg_toplevel.view.pending.box.y,
|
||||||
|
.width = @intCast(c_int, output_dimensions.width),
|
||||||
|
.height = @intCast(c_int, output_dimensions.height),
|
||||||
|
};
|
||||||
|
wlr_xdg_popup.unconstrainFromBox(&box);
|
||||||
|
},
|
||||||
|
.layer_surface => |layer_surface| {
|
||||||
|
const output_dimensions = layer_surface.output.getEffectiveResolution();
|
||||||
|
// The output box relative to the parent of the xdg_popup
|
||||||
|
var box = wlr.Box{
|
||||||
|
.x = layer_surface.box.x,
|
||||||
|
.y = layer_surface.box.y,
|
||||||
|
.width = @intCast(c_int, output_dimensions.width),
|
||||||
|
.height = @intCast(c_int, output_dimensions.height),
|
||||||
|
};
|
||||||
|
wlr_xdg_popup.unconstrainFromBox(&box);
|
||||||
|
},
|
||||||
.drag_icon => unreachable,
|
.drag_icon => unreachable,
|
||||||
};
|
}
|
||||||
const output_dimensions = switch (parent) {
|
|
||||||
.xdg_toplevel => |xdg_toplevel| xdg_toplevel.view.output.getEffectiveResolution(),
|
|
||||||
.layer_surface => |layer_surface| layer_surface.output.getEffectiveResolution(),
|
|
||||||
.drag_icon => unreachable,
|
|
||||||
};
|
|
||||||
|
|
||||||
// The output box relative to the parent of the xdg_popup
|
|
||||||
var box = wlr.Box{
|
|
||||||
.x = -parent_box.x,
|
|
||||||
.y = -parent_box.y,
|
|
||||||
.width = @intCast(c_int, output_dimensions.width),
|
|
||||||
.height = @intCast(c_int, output_dimensions.height),
|
|
||||||
};
|
|
||||||
wlr_xdg_popup.unconstrainFromBox(&box);
|
|
||||||
|
|
||||||
wlr_xdg_popup.base.events.destroy.add(&xdg_popup.surface_destroy);
|
wlr_xdg_popup.base.events.destroy.add(&xdg_popup.surface_destroy);
|
||||||
wlr_xdg_popup.base.events.map.add(&xdg_popup.map);
|
wlr_xdg_popup.base.events.map.add(&xdg_popup.map);
|
||||||
|
Loading…
Reference in New Issue
Block a user