OutputStatus: rework implementation
This was motivated by the view tags not being proplerly updated by Root.commitTransaction() when there were no views on an output.
This commit is contained in:
parent
be4330288d
commit
005bde367c
@ -159,11 +159,13 @@ fn handleRequest(layout: *river.LayoutV3, request: river.LayoutV3.Request, self:
|
|||||||
if (layout_demand.serial == req.serial) layout_demand.apply(self);
|
if (layout_demand.serial == req.serial) layout_demand.apply(self);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self.output.layout_name) |name| {
|
const new_name = util.gpa.dupeZ(u8, mem.sliceTo(req.layout_name, 0)) catch {
|
||||||
util.gpa.free(name);
|
log.err("out of memory", .{});
|
||||||
}
|
return;
|
||||||
self.output.layout_name = util.gpa.dupeZ(u8, mem.span(req.layout_name)) catch null;
|
};
|
||||||
self.output.sendLayoutName();
|
if (self.output.layout_name) |name| util.gpa.free(name);
|
||||||
|
self.output.layout_name = new_name;
|
||||||
|
self.output.status.sendLayoutName(self.output);
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -194,7 +196,7 @@ pub fn destroy(self: *Self) void {
|
|||||||
if (self.output.layout_name) |name| {
|
if (self.output.layout_name) |name| {
|
||||||
util.gpa.free(name);
|
util.gpa.free(name);
|
||||||
self.output.layout_name = null;
|
self.output.layout_name = null;
|
||||||
self.output.sendLayoutNameClear();
|
self.output.status.sendLayoutNameClear(self.output);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -171,8 +171,7 @@ layout_name: ?[:0]const u8 = null,
|
|||||||
/// affect already floating views.
|
/// affect already floating views.
|
||||||
layout: ?*Layout = null,
|
layout: ?*Layout = null,
|
||||||
|
|
||||||
/// List of status tracking objects relaying changes to this output to clients.
|
status: OutputStatus,
|
||||||
status_trackers: std.SinglyLinkedList(OutputStatus) = .{},
|
|
||||||
|
|
||||||
destroy: wl.Listener(*wlr.Output) = wl.Listener(*wlr.Output).init(handleDestroy),
|
destroy: wl.Listener(*wlr.Output) = wl.Listener(*wlr.Output).init(handleDestroy),
|
||||||
enable: wl.Listener(*wlr.Output) = wl.Listener(*wlr.Output).init(handleEnable),
|
enable: wl.Listener(*wlr.Output) = wl.Listener(*wlr.Output).init(handleEnable),
|
||||||
@ -183,7 +182,7 @@ present: wl.Listener(*wlr.Output.event.Present) = wl.Listener(*wlr.Output.event.
|
|||||||
pub fn create(wlr_output: *wlr.Output) !void {
|
pub fn create(wlr_output: *wlr.Output) !void {
|
||||||
const node = try util.gpa.create(std.TailQueue(Self).Node);
|
const node = try util.gpa.create(std.TailQueue(Self).Node);
|
||||||
errdefer util.gpa.destroy(node);
|
errdefer util.gpa.destroy(node);
|
||||||
const self = &node.data;
|
const output = &node.data;
|
||||||
|
|
||||||
if (!wlr_output.initRender(server.allocator, server.renderer)) return error.InitRenderFailed;
|
if (!wlr_output.initRender(server.allocator, server.renderer)) return error.InitRenderFailed;
|
||||||
|
|
||||||
@ -211,7 +210,7 @@ pub fn create(wlr_output: *wlr.Output) !void {
|
|||||||
const tree = try server.root.layers.outputs.createSceneTree();
|
const tree = try server.root.layers.outputs.createSceneTree();
|
||||||
const normal_content = try tree.createSceneTree();
|
const normal_content = try tree.createSceneTree();
|
||||||
|
|
||||||
self.* = .{
|
output.* = .{
|
||||||
.wlr_output = wlr_output,
|
.wlr_output = wlr_output,
|
||||||
.tree = tree,
|
.tree = tree,
|
||||||
.normal_content = normal_content,
|
.normal_content = normal_content,
|
||||||
@ -244,22 +243,25 @@ pub fn create(wlr_output: *wlr.Output) !void {
|
|||||||
.width = width,
|
.width = width,
|
||||||
.height = height,
|
.height = height,
|
||||||
},
|
},
|
||||||
|
.status = undefined,
|
||||||
};
|
};
|
||||||
wlr_output.data = @ptrToInt(self);
|
wlr_output.data = @ptrToInt(output);
|
||||||
|
|
||||||
self.pending.focus_stack.init();
|
output.pending.focus_stack.init();
|
||||||
self.pending.wm_stack.init();
|
output.pending.wm_stack.init();
|
||||||
self.inflight.focus_stack.init();
|
output.inflight.focus_stack.init();
|
||||||
self.inflight.wm_stack.init();
|
output.inflight.wm_stack.init();
|
||||||
|
|
||||||
_ = try self.layers.fullscreen.createSceneRect(width, height, &[_]f32{ 0, 0, 0, 1.0 });
|
output.status.init();
|
||||||
self.layers.fullscreen.node.setEnabled(false);
|
|
||||||
|
|
||||||
wlr_output.events.destroy.add(&self.destroy);
|
_ = try output.layers.fullscreen.createSceneRect(width, height, &[_]f32{ 0, 0, 0, 1.0 });
|
||||||
wlr_output.events.enable.add(&self.enable);
|
output.layers.fullscreen.node.setEnabled(false);
|
||||||
wlr_output.events.mode.add(&self.mode);
|
|
||||||
wlr_output.events.frame.add(&self.frame);
|
wlr_output.events.destroy.add(&output.destroy);
|
||||||
wlr_output.events.present.add(&self.present);
|
wlr_output.events.enable.add(&output.enable);
|
||||||
|
wlr_output.events.mode.add(&output.mode);
|
||||||
|
wlr_output.events.frame.add(&output.frame);
|
||||||
|
wlr_output.events.present.add(&output.present);
|
||||||
|
|
||||||
// Ensure that a cursor image at the output's scale factor is loaded
|
// Ensure that a cursor image at the output's scale factor is loaded
|
||||||
// for each seat.
|
// for each seat.
|
||||||
@ -270,13 +272,13 @@ pub fn create(wlr_output: *wlr.Output) !void {
|
|||||||
std.log.scoped(.cursor).err("failed to load xcursor theme at scale {}", .{wlr_output.scale});
|
std.log.scoped(.cursor).err("failed to load xcursor theme at scale {}", .{wlr_output.scale});
|
||||||
}
|
}
|
||||||
|
|
||||||
self.setTitle();
|
output.setTitle();
|
||||||
|
|
||||||
const ptr_node = try util.gpa.create(std.TailQueue(*Self).Node);
|
const ptr_node = try util.gpa.create(std.TailQueue(*Self).Node);
|
||||||
ptr_node.data = &node.data;
|
ptr_node.data = &node.data;
|
||||||
server.root.all_outputs.append(ptr_node);
|
server.root.all_outputs.append(ptr_node);
|
||||||
|
|
||||||
handleEnable(&self.enable, self.wlr_output);
|
handleEnable(&output.enable, wlr_output);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn layerSurfaceTree(self: Self, layer: zwlr.LayerShellV1.Layer) *wlr.SceneTree {
|
pub fn layerSurfaceTree(self: Self, layer: zwlr.LayerShellV1.Layer) *wlr.SceneTree {
|
||||||
@ -289,37 +291,6 @@ pub fn layerSurfaceTree(self: Self, layer: zwlr.LayerShellV1.Layer) *wlr.SceneTr
|
|||||||
return trees[@intCast(usize, @enumToInt(layer))];
|
return trees[@intCast(usize, @enumToInt(layer))];
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn sendViewTags(self: Self) void {
|
|
||||||
var it = self.status_trackers.first;
|
|
||||||
while (it) |node| : (it = node.next) node.data.sendViewTags();
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn sendUrgentTags(output: *Self) void {
|
|
||||||
var urgent_tags: u32 = 0;
|
|
||||||
{
|
|
||||||
var it = output.inflight.wm_stack.iterator(.forward);
|
|
||||||
while (it.next()) |view| {
|
|
||||||
if (view.current.urgent) urgent_tags |= view.current.tags;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{
|
|
||||||
var it = output.status_trackers.first;
|
|
||||||
while (it) |node| : (it = node.next) node.data.sendUrgentTags(urgent_tags);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn sendLayoutName(self: Self) void {
|
|
||||||
std.debug.assert(self.layout_name != null);
|
|
||||||
var it = self.status_trackers.first;
|
|
||||||
while (it) |node| : (it = node.next) node.data.sendLayoutName(self.layout_name.?);
|
|
||||||
}
|
|
||||||
|
|
||||||
pub fn sendLayoutNameClear(self: Self) void {
|
|
||||||
std.debug.assert(self.layout_name == null);
|
|
||||||
var it = self.status_trackers.first;
|
|
||||||
while (it) |node| : (it = node.next) node.data.sendLayoutNameClear();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Arrange all layer surfaces of this output and adjust the usable area.
|
/// Arrange all layer surfaces of this output and adjust the usable area.
|
||||||
/// Will arrange views as well if the usable area changes.
|
/// Will arrange views as well if the usable area changes.
|
||||||
pub fn arrangeLayers(self: *Self) void {
|
pub fn arrangeLayers(self: *Self) void {
|
||||||
|
@ -14,9 +14,11 @@
|
|||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
// along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
const Self = @This();
|
const OutputStatus = @This();
|
||||||
|
|
||||||
const std = @import("std");
|
const std = @import("std");
|
||||||
|
const assert = std.debug.assert;
|
||||||
|
|
||||||
const wayland = @import("wayland");
|
const wayland = @import("wayland");
|
||||||
const wl = wayland.server.wl;
|
const wl = wayland.server.wl;
|
||||||
const zriver = wayland.server.zriver;
|
const zriver = wayland.server.zriver;
|
||||||
@ -28,80 +30,143 @@ const View = @import("View.zig");
|
|||||||
|
|
||||||
const log = std.log.scoped(.river_status);
|
const log = std.log.scoped(.river_status);
|
||||||
|
|
||||||
output: *Output,
|
resources: wl.list.Head(zriver.OutputStatusV1, null),
|
||||||
output_status: *zriver.OutputStatusV1,
|
view_tags: std.ArrayListUnmanaged(u32) = .{},
|
||||||
|
focused_tags: u32 = 0,
|
||||||
|
urgent_tags: u32 = 0,
|
||||||
|
|
||||||
pub fn init(self: *Self, output: *Output, output_status: *zriver.OutputStatusV1) void {
|
pub fn init(status: *OutputStatus) void {
|
||||||
self.* = .{ .output = output, .output_status = output_status };
|
status.* = .{
|
||||||
|
.resources = undefined,
|
||||||
|
};
|
||||||
|
status.resources.init();
|
||||||
|
}
|
||||||
|
|
||||||
output_status.setHandler(*Self, handleRequest, handleDestroy, self);
|
pub fn add(status: *OutputStatus, resource: *zriver.OutputStatusV1, output: *Output) void {
|
||||||
|
resource.setHandler(?*anyopaque, handleRequest, handleDestroy, null);
|
||||||
|
|
||||||
// Send view/focused/urgent tags once on bind.
|
var wl_array: wl.Array = .{
|
||||||
self.sendViewTags();
|
.size = status.view_tags.items.len * @sizeOf(u32),
|
||||||
self.sendFocusedTags(output.current.tags);
|
.alloc = status.view_tags.items.len * @sizeOf(u32),
|
||||||
|
.data = status.view_tags.items.ptr,
|
||||||
output.sendUrgentTags();
|
};
|
||||||
|
resource.sendViewTags(&wl_array);
|
||||||
if (output.layout_name) |name| {
|
resource.sendFocusedTags(status.focused_tags);
|
||||||
self.sendLayoutName(name);
|
if (resource.getVersion() >= 2) resource.sendUrgentTags(status.urgent_tags);
|
||||||
|
if (resource.getVersion() >= 4) {
|
||||||
|
if (output.layout_name) |name| resource.sendLayoutName(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
status.resources.append(resource);
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn destroy(self: *Self) void {
|
pub fn deinit(status: *OutputStatus) void {
|
||||||
const node = @fieldParentPtr(std.SinglyLinkedList(Self).Node, "data", self);
|
|
||||||
self.output.status_trackers.remove(node);
|
|
||||||
self.output_status.setHandler(*Self, handleRequest, null, self);
|
|
||||||
util.gpa.destroy(node);
|
|
||||||
}
|
|
||||||
|
|
||||||
fn handleRequest(output_status: *zriver.OutputStatusV1, request: zriver.OutputStatusV1.Request, _: *Self) void {
|
|
||||||
switch (request) {
|
|
||||||
.destroy => output_status.destroy(),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn handleDestroy(_: *zriver.OutputStatusV1, self: *Self) void {
|
|
||||||
self.destroy();
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Send the current tags of each view on the output to the client.
|
|
||||||
pub fn sendViewTags(self: Self) void {
|
|
||||||
var view_tags = std.ArrayList(u32).init(util.gpa);
|
|
||||||
defer view_tags.deinit();
|
|
||||||
|
|
||||||
{
|
{
|
||||||
var it = self.output.inflight.wm_stack.iterator(.forward);
|
var it = status.resources.safeIterator(.forward);
|
||||||
while (it.next()) |view| {
|
while (it.next()) |resource| {
|
||||||
view_tags.append(view.current.tags) catch {
|
resource.setHandler(?*anyopaque, handleRequest, null, null);
|
||||||
self.output_status.postNoMemory();
|
resource.getLink().remove();
|
||||||
log.err("out of memory", .{});
|
}
|
||||||
return;
|
}
|
||||||
};
|
status.view_tags.deinit(util.gpa);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn handleRequest(resource: *zriver.OutputStatusV1, request: zriver.OutputStatusV1.Request, _: ?*anyopaque) void {
|
||||||
|
switch (request) {
|
||||||
|
.destroy => resource.destroy(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fn handleDestroy(resource: *zriver.OutputStatusV1, _: ?*anyopaque) void {
|
||||||
|
resource.getLink().remove();
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn handleTransactionCommit(status: *OutputStatus, output: *Output) void {
|
||||||
|
status.sendViewTags(output);
|
||||||
|
status.sendFocusedTags(output);
|
||||||
|
status.sendUrgentTags(output);
|
||||||
|
}
|
||||||
|
|
||||||
|
fn sendViewTags(status: *OutputStatus, output: *Output) void {
|
||||||
|
var dirty: bool = false;
|
||||||
|
{
|
||||||
|
var it = output.inflight.wm_stack.iterator(.forward);
|
||||||
|
var i: usize = 0;
|
||||||
|
while (it.next()) |view| : (i += 1) {
|
||||||
|
assert(view.inflight.tags == view.current.tags);
|
||||||
|
if (status.view_tags.items.len <= i) {
|
||||||
|
dirty = true;
|
||||||
|
_ = status.view_tags.addOne(util.gpa) catch {
|
||||||
|
log.err("out of memory", .{});
|
||||||
|
return;
|
||||||
|
};
|
||||||
|
} else if (view.inflight.tags != status.view_tags.items[i]) {
|
||||||
|
dirty = true;
|
||||||
|
}
|
||||||
|
status.view_tags.items[i] = view.inflight.tags;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (i != status.view_tags.items.len) {
|
||||||
|
assert(i < status.view_tags.items.len);
|
||||||
|
status.view_tags.items.len = i;
|
||||||
|
dirty = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var wl_array = wl.Array.fromArrayList(u32, view_tags);
|
if (dirty) {
|
||||||
self.output_status.sendViewTags(&wl_array);
|
var wl_array: wl.Array = .{
|
||||||
}
|
.size = status.view_tags.items.len * @sizeOf(u32),
|
||||||
|
.alloc = status.view_tags.items.len * @sizeOf(u32),
|
||||||
pub fn sendFocusedTags(self: Self, tags: u32) void {
|
.data = status.view_tags.items.ptr,
|
||||||
self.output_status.sendFocusedTags(tags);
|
};
|
||||||
}
|
var it = status.resources.iterator(.forward);
|
||||||
|
while (it.next()) |resource| resource.sendViewTags(&wl_array);
|
||||||
pub fn sendUrgentTags(self: Self, tags: u32) void {
|
|
||||||
if (self.output_status.getVersion() >= 2) {
|
|
||||||
self.output_status.sendUrgentTags(tags);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn sendLayoutName(self: Self, name: [:0]const u8) void {
|
fn sendFocusedTags(status: *OutputStatus, output: *Output) void {
|
||||||
if (self.output_status.getVersion() >= 4) {
|
assert(output.inflight.tags == output.current.tags);
|
||||||
self.output_status.sendLayoutName(name);
|
if (status.focused_tags != output.inflight.tags) {
|
||||||
|
status.focused_tags = output.inflight.tags;
|
||||||
|
|
||||||
|
var it = status.resources.iterator(.forward);
|
||||||
|
while (it.next()) |resource| resource.sendFocusedTags(status.focused_tags);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn sendLayoutNameClear(self: Self) void {
|
fn sendUrgentTags(status: *OutputStatus, output: *Output) void {
|
||||||
if (self.output_status.getVersion() >= 4) {
|
var urgent_tags: u32 = 0;
|
||||||
self.output_status.sendLayoutNameClear();
|
{
|
||||||
|
var it = output.inflight.wm_stack.iterator(.forward);
|
||||||
|
while (it.next()) |view| {
|
||||||
|
if (view.current.urgent) urgent_tags |= view.current.tags;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (status.urgent_tags != urgent_tags) {
|
||||||
|
status.urgent_tags = urgent_tags;
|
||||||
|
|
||||||
|
var it = status.resources.iterator(.forward);
|
||||||
|
while (it.next()) |resource| {
|
||||||
|
if (resource.getVersion() >= 2) resource.sendUrgentTags(urgent_tags);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn sendLayoutName(status: *OutputStatus, output: *Output) void {
|
||||||
|
assert(output.layout_name != null);
|
||||||
|
|
||||||
|
var it = status.resources.iterator(.forward);
|
||||||
|
while (it.next()) |resource| {
|
||||||
|
if (resource.getVersion() >= 4) resource.sendLayoutName(output.layout_name.?);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
pub fn sendLayoutNameClear(status: *OutputStatus, output: *Output) void {
|
||||||
|
assert(output.layout_name == null);
|
||||||
|
|
||||||
|
var it = status.resources.iterator(.forward);
|
||||||
|
while (it.next()) |resource| {
|
||||||
|
if (resource.getVersion() >= 4) resource.sendLayoutNameClear();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -298,7 +298,7 @@ pub fn removeOutput(root: *Self, output: *Output) void {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
while (output.status_trackers.first) |status_node| status_node.data.destroy();
|
output.status.deinit();
|
||||||
|
|
||||||
root.applyPending();
|
root.applyPending();
|
||||||
}
|
}
|
||||||
@ -567,12 +567,8 @@ fn commitTransaction(root: *Self) void {
|
|||||||
"changing current focus: {b:0>10} to {b:0>10}",
|
"changing current focus: {b:0>10} to {b:0>10}",
|
||||||
.{ output.current.tags, output.inflight.tags },
|
.{ output.current.tags, output.inflight.tags },
|
||||||
);
|
);
|
||||||
|
|
||||||
output.current.tags = output.pending.tags;
|
|
||||||
|
|
||||||
var it = output.status_trackers.first;
|
|
||||||
while (it) |node| : (it = node.next) node.data.sendFocusedTags(output.current.tags);
|
|
||||||
}
|
}
|
||||||
|
output.current.tags = output.inflight.tags;
|
||||||
|
|
||||||
if (output.inflight.fullscreen != output.current.fullscreen) {
|
if (output.inflight.fullscreen != output.current.fullscreen) {
|
||||||
if (output.current.fullscreen) |view| {
|
if (output.current.fullscreen) |view| {
|
||||||
@ -590,23 +586,17 @@ fn commitTransaction(root: *Self) void {
|
|||||||
output.layers.fullscreen.node.setEnabled(output.current.fullscreen != null);
|
output.layers.fullscreen.node.setEnabled(output.current.fullscreen != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
var view_tags_changed = false;
|
|
||||||
var urgent_tags_dirty = false;
|
|
||||||
|
|
||||||
var focus_stack_it = output.inflight.focus_stack.iterator(.forward);
|
var focus_stack_it = output.inflight.focus_stack.iterator(.forward);
|
||||||
while (focus_stack_it.next()) |view| {
|
while (focus_stack_it.next()) |view| {
|
||||||
assert(view.inflight.output == output);
|
assert(view.inflight.output == output);
|
||||||
|
|
||||||
view.inflight_serial = null;
|
view.inflight_serial = null;
|
||||||
|
|
||||||
if (view.inflight.tags != view.current.tags) view_tags_changed = true;
|
|
||||||
if (view.inflight.urgent != view.current.urgent) urgent_tags_dirty = true;
|
|
||||||
if (view.inflight.urgent and view_tags_changed) urgent_tags_dirty = true;
|
|
||||||
|
|
||||||
if (view.current.output != output) {
|
if (view.current.output != output) {
|
||||||
view.tree.node.reparent(output.layers.views);
|
view.tree.node.reparent(output.layers.views);
|
||||||
view.popup_tree.node.reparent(output.layers.popups);
|
view.popup_tree.node.reparent(output.layers.popups);
|
||||||
}
|
}
|
||||||
|
|
||||||
const enabled = view.current.tags & output.current.tags != 0;
|
const enabled = view.current.tags & output.current.tags != 0;
|
||||||
view.tree.node.setEnabled(enabled);
|
view.tree.node.setEnabled(enabled);
|
||||||
view.popup_tree.node.setEnabled(enabled);
|
view.popup_tree.node.setEnabled(enabled);
|
||||||
@ -616,8 +606,7 @@ fn commitTransaction(root: *Self) void {
|
|||||||
view.updateCurrent();
|
view.updateCurrent();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (view_tags_changed) output.sendViewTags();
|
output.status.handleTransactionCommit(output);
|
||||||
if (urgent_tags_dirty) output.sendUrgentTags();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -71,25 +71,17 @@ fn handleRequest(
|
|||||||
const wlr_output = wlr.Output.fromWlOutput(req.output) orelse return;
|
const wlr_output = wlr.Output.fromWlOutput(req.output) orelse return;
|
||||||
const output = @intToPtr(*Output, wlr_output.data);
|
const output = @intToPtr(*Output, wlr_output.data);
|
||||||
|
|
||||||
const node = util.gpa.create(std.SinglyLinkedList(OutputStatus).Node) catch {
|
const resource = zriver.OutputStatusV1.create(
|
||||||
status_manager.getClient().postNoMemory();
|
|
||||||
log.err("out of memory", .{});
|
|
||||||
return;
|
|
||||||
};
|
|
||||||
|
|
||||||
const output_status = zriver.OutputStatusV1.create(
|
|
||||||
status_manager.getClient(),
|
status_manager.getClient(),
|
||||||
status_manager.getVersion(),
|
status_manager.getVersion(),
|
||||||
req.id,
|
req.id,
|
||||||
) catch {
|
) catch {
|
||||||
status_manager.getClient().postNoMemory();
|
status_manager.getClient().postNoMemory();
|
||||||
util.gpa.destroy(node);
|
|
||||||
log.err("out of memory", .{});
|
log.err("out of memory", .{});
|
||||||
return;
|
return;
|
||||||
};
|
};
|
||||||
|
|
||||||
node.data.init(output, output_status);
|
output.status.add(resource, output);
|
||||||
output.status_trackers.prepend(node);
|
|
||||||
},
|
},
|
||||||
.get_river_seat_status => |req| {
|
.get_river_seat_status => |req| {
|
||||||
// ignore if the seat is inert
|
// ignore if the seat is inert
|
||||||
|
Loading…
x
Reference in New Issue
Block a user