river-layout: update to v2
This implements the changes to the river-layout protocol proposed in the previous commit removing river-options.
This commit is contained in:
@ -35,12 +35,12 @@ const LayoutDemand = @import("LayoutDemand.zig");
|
||||
|
||||
const log = std.log.scoped(.layout);
|
||||
|
||||
layout: *river.LayoutV1,
|
||||
layout: *river.LayoutV2,
|
||||
namespace: []const u8,
|
||||
output: *Output,
|
||||
|
||||
pub fn create(client: *wl.Client, version: u32, id: u32, output: *Output, namespace: []const u8) !void {
|
||||
const layout = try river.LayoutV1.create(client, version, id);
|
||||
const layout = try river.LayoutV2.create(client, version, id);
|
||||
|
||||
if (namespaceInUse(namespace, output, client)) {
|
||||
layout.sendNamespaceInUse();
|
||||
@ -91,7 +91,7 @@ fn namespaceInUse(namespace: []const u8, output: *Output, client: *wl.Client) bo
|
||||
|
||||
/// This exists to handle layouts that have been rendered inert (due to the
|
||||
/// namespace already being in use) until the client destroys them.
|
||||
fn handleRequestInert(layout: *river.LayoutV1, request: river.LayoutV1.Request, _: ?*c_void) void {
|
||||
fn handleRequestInert(layout: *river.LayoutV2, request: river.LayoutV2.Request, _: ?*c_void) void {
|
||||
if (request == .destroy) layout.destroy();
|
||||
}
|
||||
|
||||
@ -128,14 +128,10 @@ pub fn startLayoutDemand(self: *Self, views: u32) void {
|
||||
self.output.root.trackLayoutDemands();
|
||||
}
|
||||
|
||||
fn handleRequest(layout: *river.LayoutV1, request: river.LayoutV1.Request, self: *Self) void {
|
||||
fn handleRequest(layout: *river.LayoutV2, request: river.LayoutV2.Request, self: *Self) void {
|
||||
switch (request) {
|
||||
.destroy => layout.destroy(),
|
||||
|
||||
// Parameters of the layout changed. We only care about this, if the
|
||||
// layout is currently in use, in which case we rearrange the output.
|
||||
.parameters_changed => if (self == self.output.pending.layout) self.output.arrangeViews(),
|
||||
|
||||
// We receive this event when the client wants to push a view dimension proposal
|
||||
// to the layout demand matching the serial.
|
||||
.push_view_dimensions => |req| {
|
||||
@ -171,7 +167,7 @@ fn handleRequest(layout: *river.LayoutV1, request: river.LayoutV1.Request, self:
|
||||
}
|
||||
}
|
||||
|
||||
fn handleDestroy(layout: *river.LayoutV1, self: *Self) void {
|
||||
fn handleDestroy(layout: *river.LayoutV2, self: *Self) void {
|
||||
log.debug(
|
||||
"destroying layout '{}' on output '{}'",
|
||||
.{ self.namespace, self.output.wlr_output.name },
|
||||
|
Reference in New Issue
Block a user