aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--river/Control.zig7
-rw-r--r--river/Decoration.zig13
-rw-r--r--river/DecorationManager.zig8
-rw-r--r--river/LayoutManager.zig3
-rw-r--r--river/Server.zig8
-rw-r--r--river/StatusManager.zig3
6 files changed, 18 insertions, 24 deletions
diff --git a/river/Control.zig b/river/Control.zig
index 5b0fbd9..73ca0f1 100644
--- a/river/Control.zig
+++ b/river/Control.zig
@@ -19,14 +19,13 @@ const Self = @This();
const std = @import("std");
const mem = std.mem;
-
+const wlr = @import("wlroots");
const wayland = @import("wayland");
const wl = wayland.server.wl;
const zriver = wayland.server.zriver;
-const wlr = @import("wlroots");
-
const command = @import("command.zig");
+const server = &@import("main.zig").server;
const util = @import("util.zig");
const Seat = @import("Seat.zig");
@@ -40,7 +39,7 @@ args_map: ArgMap,
server_destroy: wl.Listener(*wl.Server) = wl.Listener(*wl.Server).init(handleServerDestroy),
-pub fn init(self: *Self, server: *Server) !void {
+pub fn init(self: *Self) !void {
self.* = .{
.global = try wl.Global.create(server.wl_server, zriver.ControlV1, 1, *Self, self, bind),
.args_map = ArgMap.init(util.gpa),
diff --git a/river/Decoration.zig b/river/Decoration.zig
index 2ad773d..70437e5 100644
--- a/river/Decoration.zig
+++ b/river/Decoration.zig
@@ -21,12 +21,11 @@ const std = @import("std");
const wlr = @import("wlroots");
const wl = @import("wayland").server.wl;
+const server = &@import("main.zig").server;
const util = @import("util.zig");
const Server = @import("Server.zig");
-server: *Server,
-
xdg_toplevel_decoration: *wlr.XdgToplevelDecorationV1,
// zig fmt: off
@@ -36,12 +35,8 @@ request_mode: wl.Listener(*wlr.XdgToplevelDecorationV1) =
wl.Listener(*wlr.XdgToplevelDecorationV1).init(handleRequestMode),
// zig fmt: on
-pub fn init(
- self: *Self,
- server: *Server,
- xdg_toplevel_decoration: *wlr.XdgToplevelDecorationV1,
-) void {
- self.* = .{ .server = server, .xdg_toplevel_decoration = xdg_toplevel_decoration };
+pub fn init(self: *Self, xdg_toplevel_decoration: *wlr.XdgToplevelDecorationV1) void {
+ self.* = .{ .xdg_toplevel_decoration = xdg_toplevel_decoration };
xdg_toplevel_decoration.events.destroy.add(&self.destroy);
xdg_toplevel_decoration.events.request_mode.add(&self.request_mode);
@@ -67,7 +62,7 @@ fn handleRequestMode(
const app_id: [*:0]const u8 = if (toplevel.app_id) |id| id else "NULL";
_ = self.xdg_toplevel_decoration.setMode(
- for (self.server.config.csd_filter.items) |filter_app_id| {
+ for (server.config.csd_filter.items) |filter_app_id| {
if (std.mem.eql(u8, std.mem.span(app_id), filter_app_id)) break .client_side;
} else .server_side,
);
diff --git a/river/DecorationManager.zig b/river/DecorationManager.zig
index f2b9809..aec1328 100644
--- a/river/DecorationManager.zig
+++ b/river/DecorationManager.zig
@@ -21,13 +21,12 @@ const std = @import("std");
const wlr = @import("wlroots");
const wl = @import("wayland").server.wl;
+const server = &@import("main.zig").server;
const util = @import("util.zig");
const Decoration = @import("Decoration.zig");
const Server = @import("Server.zig");
-server: *Server,
-
xdg_decoration_manager: *wlr.XdgDecorationManagerV1,
// zig fmt: off
@@ -35,9 +34,8 @@ new_toplevel_decoration: wl.Listener(*wlr.XdgToplevelDecorationV1) =
wl.Listener(*wlr.XdgToplevelDecorationV1).init(handleNewToplevelDecoration),
// zig fmt: on
-pub fn init(self: *Self, server: *Server) !void {
+pub fn init(self: *Self) !void {
self.* = .{
- .server = server,
.xdg_decoration_manager = try wlr.XdgDecorationManagerV1.create(server.wl_server),
};
@@ -53,5 +51,5 @@ fn handleNewToplevelDecoration(
xdg_toplevel_decoration.resource.postNoMemory();
return;
};
- decoration.init(self.server, xdg_toplevel_decoration);
+ decoration.init(xdg_toplevel_decoration);
}
diff --git a/river/LayoutManager.zig b/river/LayoutManager.zig
index 618f2ad..5e17eae 100644
--- a/river/LayoutManager.zig
+++ b/river/LayoutManager.zig
@@ -24,6 +24,7 @@ const wayland = @import("wayland");
const wl = wayland.server.wl;
const river = wayland.server.river;
+const server = &@import("main.zig").server;
const util = @import("util.zig");
const Layout = @import("Layout.zig");
@@ -35,7 +36,7 @@ const log = std.log.scoped(.layout);
global: *wl.Global,
server_destroy: wl.Listener(*wl.Server) = wl.Listener(*wl.Server).init(handleServerDestroy),
-pub fn init(self: *Self, server: *Server) !void {
+pub fn init(self: *Self) !void {
self.* = .{
.global = try wl.Global.create(server.wl_server, river.LayoutManagerV2, 1, *Self, self, bind),
};
diff --git a/river/Server.zig b/river/Server.zig
index db9e239..d887541 100644
--- a/river/Server.zig
+++ b/river/Server.zig
@@ -112,13 +112,13 @@ pub fn init(self: *Self) !void {
_ = try wlr.PrimarySelectionDeviceManagerV1.create(self.wl_server);
self.config = try Config.init();
- try self.decoration_manager.init(self);
+ try self.decoration_manager.init();
try self.root.init();
// Must be called after root is initialized
try self.input_manager.init();
- try self.control.init(self);
- try self.status_manager.init(self);
- try self.layout_manager.init(self);
+ try self.control.init();
+ try self.status_manager.init();
+ try self.layout_manager.init();
// These all free themselves when the wl_server is destroyed
_ = try wlr.DataDeviceManager.create(self.wl_server);
diff --git a/river/StatusManager.zig b/river/StatusManager.zig
index 6de8877..245cef2 100644
--- a/river/StatusManager.zig
+++ b/river/StatusManager.zig
@@ -23,6 +23,7 @@ const wayland = @import("wayland");
const wl = wayland.server.wl;
const zriver = wayland.server.zriver;
+const server = &@import("main.zig").server;
const util = @import("util.zig");
const Output = @import("Output.zig");
@@ -37,7 +38,7 @@ global: *wl.Global,
server_destroy: wl.Listener(*wl.Server) = wl.Listener(*wl.Server).init(handleServerDestroy),
-pub fn init(self: *Self, server: *Server) !void {
+pub fn init(self: *Self) !void {
self.* = .{
.global = try wl.Global.create(server.wl_server, zriver.StatusManagerV1, 1, *Self, self, bind),
};