river: remove misc stored *Server pointers

These are no longer needed as server is now global.
This commit is contained in:
Isaac Freund 2021-05-13 15:06:00 +02:00
parent ece465b7ed
commit 3d031631c7
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11
6 changed files with 18 additions and 24 deletions

View File

@ -19,14 +19,13 @@ const Self = @This();
const std = @import("std"); const std = @import("std");
const mem = std.mem; const mem = std.mem;
const wlr = @import("wlroots");
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;
const wlr = @import("wlroots");
const command = @import("command.zig"); const command = @import("command.zig");
const server = &@import("main.zig").server;
const util = @import("util.zig"); const util = @import("util.zig");
const Seat = @import("Seat.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), 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.* = .{ self.* = .{
.global = try wl.Global.create(server.wl_server, zriver.ControlV1, 1, *Self, self, bind), .global = try wl.Global.create(server.wl_server, zriver.ControlV1, 1, *Self, self, bind),
.args_map = ArgMap.init(util.gpa), .args_map = ArgMap.init(util.gpa),

View File

@ -21,12 +21,11 @@ const std = @import("std");
const wlr = @import("wlroots"); const wlr = @import("wlroots");
const wl = @import("wayland").server.wl; const wl = @import("wayland").server.wl;
const server = &@import("main.zig").server;
const util = @import("util.zig"); const util = @import("util.zig");
const Server = @import("Server.zig"); const Server = @import("Server.zig");
server: *Server,
xdg_toplevel_decoration: *wlr.XdgToplevelDecorationV1, xdg_toplevel_decoration: *wlr.XdgToplevelDecorationV1,
// zig fmt: off // zig fmt: off
@ -36,12 +35,8 @@ request_mode: wl.Listener(*wlr.XdgToplevelDecorationV1) =
wl.Listener(*wlr.XdgToplevelDecorationV1).init(handleRequestMode), wl.Listener(*wlr.XdgToplevelDecorationV1).init(handleRequestMode),
// zig fmt: on // zig fmt: on
pub fn init( pub fn init(self: *Self, xdg_toplevel_decoration: *wlr.XdgToplevelDecorationV1) void {
self: *Self, self.* = .{ .xdg_toplevel_decoration = xdg_toplevel_decoration };
server: *Server,
xdg_toplevel_decoration: *wlr.XdgToplevelDecorationV1,
) void {
self.* = .{ .server = server, .xdg_toplevel_decoration = xdg_toplevel_decoration };
xdg_toplevel_decoration.events.destroy.add(&self.destroy); xdg_toplevel_decoration.events.destroy.add(&self.destroy);
xdg_toplevel_decoration.events.request_mode.add(&self.request_mode); 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"; const app_id: [*:0]const u8 = if (toplevel.app_id) |id| id else "NULL";
_ = self.xdg_toplevel_decoration.setMode( _ = 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; if (std.mem.eql(u8, std.mem.span(app_id), filter_app_id)) break .client_side;
} else .server_side, } else .server_side,
); );

View File

@ -21,13 +21,12 @@ const std = @import("std");
const wlr = @import("wlroots"); const wlr = @import("wlroots");
const wl = @import("wayland").server.wl; const wl = @import("wayland").server.wl;
const server = &@import("main.zig").server;
const util = @import("util.zig"); const util = @import("util.zig");
const Decoration = @import("Decoration.zig"); const Decoration = @import("Decoration.zig");
const Server = @import("Server.zig"); const Server = @import("Server.zig");
server: *Server,
xdg_decoration_manager: *wlr.XdgDecorationManagerV1, xdg_decoration_manager: *wlr.XdgDecorationManagerV1,
// zig fmt: off // zig fmt: off
@ -35,9 +34,8 @@ new_toplevel_decoration: wl.Listener(*wlr.XdgToplevelDecorationV1) =
wl.Listener(*wlr.XdgToplevelDecorationV1).init(handleNewToplevelDecoration), wl.Listener(*wlr.XdgToplevelDecorationV1).init(handleNewToplevelDecoration),
// zig fmt: on // zig fmt: on
pub fn init(self: *Self, server: *Server) !void { pub fn init(self: *Self) !void {
self.* = .{ self.* = .{
.server = server,
.xdg_decoration_manager = try wlr.XdgDecorationManagerV1.create(server.wl_server), .xdg_decoration_manager = try wlr.XdgDecorationManagerV1.create(server.wl_server),
}; };
@ -53,5 +51,5 @@ fn handleNewToplevelDecoration(
xdg_toplevel_decoration.resource.postNoMemory(); xdg_toplevel_decoration.resource.postNoMemory();
return; return;
}; };
decoration.init(self.server, xdg_toplevel_decoration); decoration.init(xdg_toplevel_decoration);
} }

View File

@ -24,6 +24,7 @@ const wayland = @import("wayland");
const wl = wayland.server.wl; const wl = wayland.server.wl;
const river = wayland.server.river; const river = wayland.server.river;
const server = &@import("main.zig").server;
const util = @import("util.zig"); const util = @import("util.zig");
const Layout = @import("Layout.zig"); const Layout = @import("Layout.zig");
@ -35,7 +36,7 @@ const log = std.log.scoped(.layout);
global: *wl.Global, global: *wl.Global,
server_destroy: wl.Listener(*wl.Server) = wl.Listener(*wl.Server).init(handleServerDestroy), 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.* = .{ self.* = .{
.global = try wl.Global.create(server.wl_server, river.LayoutManagerV2, 1, *Self, self, bind), .global = try wl.Global.create(server.wl_server, river.LayoutManagerV2, 1, *Self, self, bind),
}; };

View File

@ -112,13 +112,13 @@ pub fn init(self: *Self) !void {
_ = try wlr.PrimarySelectionDeviceManagerV1.create(self.wl_server); _ = try wlr.PrimarySelectionDeviceManagerV1.create(self.wl_server);
self.config = try Config.init(); self.config = try Config.init();
try self.decoration_manager.init(self); try self.decoration_manager.init();
try self.root.init(); try self.root.init();
// Must be called after root is initialized // Must be called after root is initialized
try self.input_manager.init(); try self.input_manager.init();
try self.control.init(self); try self.control.init();
try self.status_manager.init(self); try self.status_manager.init();
try self.layout_manager.init(self); try self.layout_manager.init();
// These all free themselves when the wl_server is destroyed // These all free themselves when the wl_server is destroyed
_ = try wlr.DataDeviceManager.create(self.wl_server); _ = try wlr.DataDeviceManager.create(self.wl_server);

View File

@ -23,6 +23,7 @@ const wayland = @import("wayland");
const wl = wayland.server.wl; const wl = wayland.server.wl;
const zriver = wayland.server.zriver; const zriver = wayland.server.zriver;
const server = &@import("main.zig").server;
const util = @import("util.zig"); const util = @import("util.zig");
const Output = @import("Output.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), 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.* = .{ self.* = .{
.global = try wl.Global.create(server.wl_server, zriver.StatusManagerV1, 1, *Self, self, bind), .global = try wl.Global.create(server.wl_server, zriver.StatusManagerV1, 1, *Self, self, bind),
}; };