river: remove all stored *Root pointers

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

View File

@ -33,7 +33,6 @@ const Box = @import("Box.zig");
const LayerSurface = @import("LayerSurface.zig"); const LayerSurface = @import("LayerSurface.zig");
const Layout = @import("Layout.zig"); const Layout = @import("Layout.zig");
const LayoutDemand = @import("LayoutDemand.zig"); const LayoutDemand = @import("LayoutDemand.zig");
const Root = @import("Root.zig");
const View = @import("View.zig"); const View = @import("View.zig");
const ViewStack = @import("view_stack.zig").ViewStack; const ViewStack = @import("view_stack.zig").ViewStack;
const AttachMode = @import("view_stack.zig").AttachMode; const AttachMode = @import("view_stack.zig").AttachMode;

View File

@ -236,7 +236,7 @@ fn handleNewXwaylandSurface(listener: *wl.Listener(*wlr.XwaylandSurface), wlr_xw
// The unmanged surface will add itself to the list of unmanaged views // The unmanged surface will add itself to the list of unmanaged views
// in Root when it is mapped. // in Root when it is mapped.
const node = util.gpa.create(std.TailQueue(XwaylandUnmanaged).Node) catch return; const node = util.gpa.create(std.TailQueue(XwaylandUnmanaged).Node) catch return;
node.data.init(&self.root, wlr_xwayland_surface); node.data.init(wlr_xwayland_surface);
return; return;
} }

View File

@ -29,7 +29,6 @@ const util = @import("util.zig");
const Box = @import("Box.zig"); const Box = @import("Box.zig");
const Output = @import("Output.zig"); const Output = @import("Output.zig");
const Root = @import("Root.zig");
const Seat = @import("Seat.zig"); const Seat = @import("Seat.zig");
const ViewStack = @import("view_stack.zig").ViewStack; const ViewStack = @import("view_stack.zig").ViewStack;
const XdgToplevel = @import("XdgToplevel.zig"); const XdgToplevel = @import("XdgToplevel.zig");

View File

@ -21,12 +21,10 @@ 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 Box = @import("Box.zig"); const Box = @import("Box.zig");
const Root = @import("Root.zig");
root: *Root,
/// The corresponding wlroots object /// The corresponding wlroots object
xwayland_surface: *wlr.XwaylandSurface, xwayland_surface: *wlr.XwaylandSurface,
@ -40,8 +38,8 @@ destroy: wl.Listener(*wlr.XwaylandSurface) = wl.Listener(*wlr.XwaylandSurface).i
map: wl.Listener(*wlr.XwaylandSurface) = wl.Listener(*wlr.XwaylandSurface).init(handleMap), map: wl.Listener(*wlr.XwaylandSurface) = wl.Listener(*wlr.XwaylandSurface).init(handleMap),
unmap: wl.Listener(*wlr.XwaylandSurface) = wl.Listener(*wlr.XwaylandSurface).init(handleUnmap), unmap: wl.Listener(*wlr.XwaylandSurface) = wl.Listener(*wlr.XwaylandSurface).init(handleUnmap),
pub fn init(self: *Self, root: *Root, xwayland_surface: *wlr.XwaylandSurface) void { pub fn init(self: *Self, xwayland_surface: *wlr.XwaylandSurface) void {
self.* = .{ .root = root, .xwayland_surface = xwayland_surface }; self.* = .{ .xwayland_surface = xwayland_surface };
// Add listeners that are active over the the entire lifetime // Add listeners that are active over the the entire lifetime
xwayland_surface.events.request_configure.add(&self.request_configure); xwayland_surface.events.request_configure.add(&self.request_configure);
@ -75,11 +73,10 @@ fn handleDestroy(listener: *wl.Listener(*wlr.XwaylandSurface), xwayland_surface:
/// Called when the xwayland surface is mapped, or ready to display on-screen. /// Called when the xwayland surface is mapped, or ready to display on-screen.
fn handleMap(listener: *wl.Listener(*wlr.XwaylandSurface), xwayland_surface: *wlr.XwaylandSurface) void { fn handleMap(listener: *wl.Listener(*wlr.XwaylandSurface), xwayland_surface: *wlr.XwaylandSurface) void {
const self = @fieldParentPtr(Self, "map", listener); const self = @fieldParentPtr(Self, "map", listener);
const root = self.root;
// Add self to the list of unmanaged views in the root // Add self to the list of unmanaged views in the root
const node = @fieldParentPtr(std.TailQueue(Self).Node, "data", self); const node = @fieldParentPtr(std.TailQueue(Self).Node, "data", self);
root.xwayland_unmanaged_views.prepend(node); server.root.xwayland_unmanaged_views.prepend(node);
// TODO: handle keyboard focus // TODO: handle keyboard focus
// if (wlr_xwayland_or_surface_wants_focus(self.xwayland_surface)) { ... // if (wlr_xwayland_or_surface_wants_focus(self.xwayland_surface)) { ...
@ -91,5 +88,5 @@ fn handleUnmap(listener: *wl.Listener(*wlr.XwaylandSurface), xwayland_surface: *
// Remove self from the list of unmanged views in the root // Remove self from the list of unmanged views in the root
const node = @fieldParentPtr(std.TailQueue(Self).Node, "data", self); const node = @fieldParentPtr(std.TailQueue(Self).Node, "data", self);
self.root.xwayland_unmanaged_views.remove(node); server.root.xwayland_unmanaged_views.remove(node);
} }