Output: fix background of transformed outputs
This commit is contained in:
parent
b1540e2d94
commit
ed0aa73670
@ -395,22 +395,22 @@ fn handleEnable(listener: *wl.Listener(*wlr.Output), wlr_output: *wlr.Output) vo
|
||||
}
|
||||
|
||||
fn handleMode(listener: *wl.Listener(*wlr.Output), _: *wlr.Output) void {
|
||||
const self = @fieldParentPtr(Self, "mode", listener);
|
||||
const output = @fieldParentPtr(Self, "mode", listener);
|
||||
|
||||
{
|
||||
output.updateBackgroundRect();
|
||||
output.arrangeLayers();
|
||||
server.root.applyPending();
|
||||
}
|
||||
|
||||
pub fn updateBackgroundRect(output: *Self) void {
|
||||
var width: c_int = undefined;
|
||||
var height: c_int = undefined;
|
||||
self.wlr_output.effectiveResolution(&width, &height);
|
||||
self.layers.background_color_rect.setSize(width, height);
|
||||
output.wlr_output.effectiveResolution(&width, &height);
|
||||
output.layers.background_color_rect.setSize(width, height);
|
||||
|
||||
var it = self.layers.fullscreen.children.iterator(.forward);
|
||||
const background_color_rect = @fieldParentPtr(wlr.SceneRect, "node", it.next().?);
|
||||
background_color_rect.setSize(width, height);
|
||||
|
||||
log.info("new output mode, width: {}, height: {}", .{ width, height });
|
||||
}
|
||||
|
||||
server.root.applyPending();
|
||||
var it = output.layers.fullscreen.children.iterator(.forward);
|
||||
const fullscreen_background = @fieldParentPtr(wlr.SceneRect, "node", it.next().?);
|
||||
fullscreen_background.setSize(width, height);
|
||||
}
|
||||
|
||||
fn handleFrame(listener: *wl.Listener(*wlr.Output), _: *wlr.Output) void {
|
||||
|
@ -729,6 +729,11 @@ fn processOutputConfig(
|
||||
self.output_layout.add(output.wlr_output, head.state.x, head.state.y);
|
||||
output.tree.node.setEnabled(true);
|
||||
output.tree.node.setPosition(head.state.x, head.state.y);
|
||||
// Even though we call this in the output's handler for the mode event
|
||||
// it is necessary to call it here as well since changing e.g. only
|
||||
// the transform will require the dimensions of the background to be
|
||||
// updated but will not trigger a mode event.
|
||||
output.updateBackgroundRect();
|
||||
output.arrangeLayers();
|
||||
} else {
|
||||
self.removeOutput(output);
|
||||
|
Loading…
Reference in New Issue
Block a user