git.lucas.co / cce-compositor
Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git

commit7b47e95f4aca9efd1e5dbc732099a807b9a01d31
parentcfeeaddf6e
authorIsaac Freund <[email protected]>
date2024-07-31 13:42
Xwayland: shorten naming conventions

 river/Seat.zig                     |   2 +-
 river/Server.zig                   |   6 +-
 river/Window.zig                   |  30 +++---
 river/XwaylandOverrideRedirect.zig |  64 ++++++-------
 river/XwaylandWindow.zig           | 189 ++++++++++++++++++-------------------
 5 files changed, 143 insertions(+), 148 deletions(-)

diff --git a/river/Seat.zig b/river/Seat.zig
index 48e8f98..ff6bdaf 100644
--- a/river/Seat.zig
+++ b/river/Seat.zig
@@ -55,7 +55,7 @@ pub const FocusTarget = union(enum) {
     pub fn surface(target: FocusTarget) ?*wlr.Surface {
         return switch (target) {
             .window => |window| window.rootSurface(),
-            .override_redirect => |override_redirect| override_redirect.xwayland_surface.surface,
+            .override_redirect => |override_redirect| override_redirect.xsurface.surface,
             .layer => |layer| layer.wlr_layer_surface.surface,
             .lock_surface => |lock_surface| lock_surface.wlr_lock_surface.surface,
             .none => null,
diff --git a/river/Server.zig b/river/Server.zig
index 620c19c..d712364 100644
--- a/river/Server.zig
+++ b/river/Server.zig
@@ -90,7 +90,7 @@ lock_manager: LockManager,
 wm: WindowManager,
 
 xwayland: if (build_options.xwayland) ?*wlr.Xwayland else void = if (build_options.xwayland) null,
-new_xwayland_surface: if (build_options.xwayland) wl.Listener(*wlr.XwaylandSurface) else void =
+new_xsurface: if (build_options.xwayland) wl.Listener(*wlr.XwaylandSurface) else void =
     if (build_options.xwayland) wl.Listener(*wlr.XwaylandSurface).init(handleNewXwaylandSurface),
 
 new_xdg_toplevel: wl.Listener(*wlr.XdgToplevel) =
@@ -174,7 +174,7 @@ pub fn init(server: *Server, runtime_xwayland: bool) !void {
 
     if (build_options.xwayland and runtime_xwayland) {
         server.xwayland = try wlr.Xwayland.create(wl_server, compositor, false);
-        server.xwayland.?.events.new_surface.add(&server.new_xwayland_surface);
+        server.xwayland.?.events.new_surface.add(&server.new_xsurface);
     }
 
     try server.root.init();
@@ -205,7 +205,7 @@ pub fn deinit(server: *Server) void {
 
     if (build_options.xwayland) {
         if (server.xwayland) |xwayland| {
-            server.new_xwayland_surface.link.remove();
+            server.new_xsurface.link.remove();
             xwayland.destroy();
         }
     }
diff --git a/river/Window.zig b/river/Window.zig
index 1aa14a5..f3bcdeb 100644
--- a/river/Window.zig
+++ b/river/Window.zig
@@ -47,7 +47,7 @@ pub const Constraints = struct {
 
 const Impl = union(enum) {
     toplevel: XdgToplevel,
-    xwayland_window: if (build_options.xwayland) XwaylandWindow else noreturn,
+    xwayland: if (build_options.xwayland) XwaylandWindow else noreturn,
     /// This state is assigned during destruction after the xdg toplevel
     /// has been destroyed but while the transaction system is still rendering
     /// saved surfaces of the window.
@@ -123,7 +123,7 @@ saved_surface_tree: *wlr.SceneTree,
 borders: [4]*wlr.SceneRect,
 popup_tree: *wlr.SceneTree,
 
-/// Bounds on the width/height of the window, set by the toplevel/xwayland_window implementation.
+/// Bounds on the width/height of the window, set by the toplevel/xwindow implementation.
 constraints: Constraints = .{},
 
 /// Set to true once the window manager client has made its first commit
@@ -531,18 +531,18 @@ pub fn commitTransaction(window: *Window) void {
                 .timed_out, .timed_out_acked => unreachable,
             }
         },
-        .xwayland_window => |xwayland_window| {
+        .xwayland => |xwindow| {
             if (window.inflight.resizing) {
                 window.resizeUpdatePosition(
-                    xwayland_window.xwayland_surface.width,
-                    xwayland_window.xwayland_surface.height,
+                    xwindow.xsurface.width,
+                    xwindow.xsurface.height,
                 );
             }
 
-            window.inflight.box.width = xwayland_window.xwayland_surface.width;
-            window.inflight.box.height = xwayland_window.xwayland_surface.height;
-            window.pending.box.width = xwayland_window.xwayland_surface.width;
-            window.pending.box.height = xwayland_window.xwayland_surface.height;
+            window.inflight.box.width = xwindow.xsurface.width;
+            window.inflight.box.height = xwindow.xsurface.height;
+            window.pending.box.width = xwindow.xsurface.width;
+            window.pending.box.height = xwindow.xsurface.height;
 
             window.current = window.inflight;
         },
@@ -609,7 +609,7 @@ pub fn configure(window: *Window) bool {
     assert(window.mapped and !window.destroying);
     switch (window.impl) {
         .toplevel => |*toplevel| return toplevel.configure(),
-        .xwayland_window => |*xwayland_window| return xwayland_window.configure(),
+        .xwayland => |*xwindow| return xwindow.configure(),
         .none => unreachable,
     }
 }
@@ -620,7 +620,7 @@ pub fn configure(window: *Window) bool {
 pub fn rootSurface(window: Window) ?*wlr.Surface {
     return switch (window.impl) {
         .toplevel => |toplevel| toplevel.wlr_toplevel.base.surface,
-        .xwayland_window => |xwayland_window| xwayland_window.xwayland_surface.surface,
+        .xwayland => |xwindow| xwindow.xsurface.surface,
         .none => null,
     };
 }
@@ -672,7 +672,7 @@ fn saveSurfaceTreeIter(
 pub fn close(window: Window) void {
     switch (window.impl) {
         .toplevel => |toplevel| toplevel.wlr_toplevel.sendClose(),
-        .xwayland_window => |xwayland_window| xwayland_window.xwayland_surface.close(),
+        .xwayland => |xwindow| xwindow.xsurface.close(),
         .none => {},
     }
 }
@@ -680,7 +680,7 @@ pub fn close(window: Window) void {
 pub fn destroyPopups(window: Window) void {
     switch (window.impl) {
         .toplevel => |toplevel| toplevel.destroyPopups(),
-        .xwayland_window, .none => {},
+        .xwayland, .none => {},
     }
 }
 
@@ -689,7 +689,7 @@ pub fn getTitle(window: Window) ?[*:0]const u8 {
     assert(!window.destroying);
     return switch (window.impl) {
         .toplevel => |toplevel| toplevel.wlr_toplevel.title,
-        .xwayland_window => |xwayland_window| xwayland_window.xwayland_surface.title,
+        .xwayland => |xwindow| xwindow.xsurface.title,
         .none => unreachable,
     };
 }
@@ -700,7 +700,7 @@ pub fn getAppId(window: Window) ?[*:0]const u8 {
     return switch (window.impl) {
         .toplevel => |toplevel| toplevel.wlr_toplevel.app_id,
         // X11 clients don't have an app_id but the class serves a similar role.
-        .xwayland_window => |xwayland_window| xwayland_window.xwayland_surface.class,
+        .xwayland => |xwindow| xwindow.xsurface.class,
         .none => unreachable,
     };
 }
diff --git a/river/XwaylandOverrideRedirect.zig b/river/XwaylandOverrideRedirect.zig
index 835ef00..0b4af70 100644
--- a/river/XwaylandOverrideRedirect.zig
+++ b/river/XwaylandOverrideRedirect.zig
@@ -31,7 +31,7 @@ const XwaylandWindow = @import("XwaylandWindow.zig");
 
 const log = std.log.scoped(.xwayland);
 
-xwayland_surface: *wlr.XwaylandSurface,
+xsurface: *wlr.XwaylandSurface,
 surface_tree: ?*wlr.SceneTree = null,
 
 // Active over entire lifetime
@@ -42,27 +42,27 @@ set_override_redirect: wl.Listener(void) = wl.Listener(void).init(handleSetOverr
 associate: wl.Listener(void) = wl.Listener(void).init(handleAssociate),
 dissociate: wl.Listener(void) = wl.Listener(void).init(handleDissociate),
 
-// Active while the xwayland_surface is associated with a wlr_surface
+// Active while the xsurface is associated with a wlr_surface
 map: wl.Listener(void) = wl.Listener(void).init(handleMap),
 unmap: wl.Listener(void) = wl.Listener(void).init(handleUnmap),
 
 // Active while mapped
 set_geometry: wl.Listener(void) = wl.Listener(void).init(handleSetGeometry),
 
-pub fn create(xwayland_surface: *wlr.XwaylandSurface) error{OutOfMemory}!void {
+pub fn create(xsurface: *wlr.XwaylandSurface) error{OutOfMemory}!void {
     const override_redirect = try util.gpa.create(XwaylandOverrideRedirect);
     errdefer util.gpa.destroy(override_redirect);
 
-    override_redirect.* = .{ .xwayland_surface = xwayland_surface };
+    override_redirect.* = .{ .xsurface = xsurface };
 
-    xwayland_surface.events.request_configure.add(&override_redirect.request_configure);
-    xwayland_surface.events.destroy.add(&override_redirect.destroy);
-    xwayland_surface.events.set_override_redirect.add(&override_redirect.set_override_redirect);
+    xsurface.events.request_configure.add(&override_redirect.request_configure);
+    xsurface.events.destroy.add(&override_redirect.destroy);
+    xsurface.events.set_override_redirect.add(&override_redirect.set_override_redirect);
 
-    xwayland_surface.events.associate.add(&override_redirect.associate);
-    xwayland_surface.events.dissociate.add(&override_redirect.dissociate);
+    xsurface.events.associate.add(&override_redirect.associate);
+    xsurface.events.dissociate.add(&override_redirect.dissociate);
 
-    if (xwayland_surface.surface) |surface| {
+    if (xsurface.surface) |surface| {
         handleAssociate(&override_redirect.associate);
         if (surface.mapped) {
             handleMap(&override_redirect.map);
@@ -92,8 +92,8 @@ fn handleDestroy(listener: *wl.Listener(void)) void {
 fn handleAssociate(listener: *wl.Listener(void)) void {
     const override_redirect: *XwaylandOverrideRedirect = @fieldParentPtr("associate", listener);
 
-    override_redirect.xwayland_surface.surface.?.events.map.add(&override_redirect.map);
-    override_redirect.xwayland_surface.surface.?.events.unmap.add(&override_redirect.unmap);
+    override_redirect.xsurface.surface.?.events.map.add(&override_redirect.map);
+    override_redirect.xsurface.surface.?.events.unmap.add(&override_redirect.unmap);
 }
 
 fn handleDissociate(listener: *wl.Listener(void)) void {
@@ -108,12 +108,12 @@ pub fn handleMap(listener: *wl.Listener(void)) void {
 
     override_redirect.mapImpl() catch {
         log.err("out of memory", .{});
-        override_redirect.xwayland_surface.surface.?.resource.getClient().postNoMemory();
+        override_redirect.xsurface.surface.?.resource.getClient().postNoMemory();
     };
 }
 
 fn mapImpl(override_redirect: *XwaylandOverrideRedirect) error{OutOfMemory}!void {
-    const surface = override_redirect.xwayland_surface.surface.?;
+    const surface = override_redirect.xsurface.surface.?;
     override_redirect.surface_tree =
         try server.root.layers.override_redirect.createSceneSubsurfaceTree(surface);
     try SceneNodeData.attach(&override_redirect.surface_tree.?.node, .{
@@ -123,11 +123,11 @@ fn mapImpl(override_redirect: *XwaylandOverrideRedirect) error{OutOfMemory}!void
     surface.data = @intFromPtr(&override_redirect.surface_tree.?.node);
 
     override_redirect.surface_tree.?.node.setPosition(
-        override_redirect.xwayland_surface.x,
-        override_redirect.xwayland_surface.y,
+        override_redirect.xsurface.x,
+        override_redirect.xsurface.y,
     );
 
-    override_redirect.xwayland_surface.events.set_geometry.add(&override_redirect.set_geometry);
+    override_redirect.xsurface.events.set_geometry.add(&override_redirect.set_geometry);
 
     override_redirect.focusIfDesired();
 }
@@ -135,8 +135,8 @@ fn mapImpl(override_redirect: *XwaylandOverrideRedirect) error{OutOfMemory}!void
 pub fn focusIfDesired(override_redirect: *XwaylandOverrideRedirect) void {
     if (server.lock_manager.state != .unlocked) return;
 
-    if (override_redirect.xwayland_surface.overrideRedirectWantsFocus() and
-        override_redirect.xwayland_surface.icccmInputModel() != .none)
+    if (override_redirect.xsurface.overrideRedirectWantsFocus() and
+        override_redirect.xsurface.icccmInputModel() != .none)
     {
         const seat = server.input_manager.defaultSeat();
         // Keep the parent top-level Xwayland window of any override redirect surface
@@ -144,10 +144,10 @@ pub fn focusIfDesired(override_redirect: *XwaylandOverrideRedirect) void {
         // override redirect menus do not disappear as a result of deactivating
         // their parent window.
         if (seat.focused == .window and
-            seat.focused.window.impl == .xwayland_window and
-            seat.focused.window.impl.xwayland_window.xwayland_surface.pid == override_redirect.xwayland_surface.pid)
+            seat.focused.window.impl == .xwayland and
+            seat.focused.window.impl.xwayland.xsurface.pid == override_redirect.xsurface.pid)
         {
-            seat.keyboardEnterOrLeave(override_redirect.xwayland_surface.surface);
+            seat.keyboardEnterOrLeave(override_redirect.xsurface.surface);
         } else {
             seat.setFocusRaw(.{ .override_redirect = override_redirect });
         }
@@ -159,7 +159,7 @@ fn handleUnmap(listener: *wl.Listener(void)) void {
 
     override_redirect.set_geometry.link.remove();
 
-    override_redirect.xwayland_surface.surface.?.data = 0;
+    override_redirect.xsurface.surface.?.data = 0;
     override_redirect.surface_tree.?.node.destroy();
     override_redirect.surface_tree = null;
 
@@ -168,9 +168,9 @@ fn handleUnmap(listener: *wl.Listener(void)) void {
     var seat_it = server.input_manager.seats.first;
     while (seat_it) |seat_node| : (seat_it = seat_node.next) {
         const seat = &seat_node.data;
-        if (seat.focused == .window and seat.focused.window.impl == .xwayland_window and
-            seat.focused.window.impl.xwayland_window.xwayland_surface.pid == override_redirect.xwayland_surface.pid and
-            seat.wlr_seat.keyboard_state.focused_surface == override_redirect.xwayland_surface.surface)
+        if (seat.focused == .window and seat.focused.window.impl == .xwayland and
+            seat.focused.window.impl.xwayland.xsurface.pid == override_redirect.xsurface.pid and
+            seat.wlr_seat.keyboard_state.focused_surface == override_redirect.xsurface.surface)
         {
             seat.keyboardEnterOrLeave(seat.focused.window.rootSurface());
         }
@@ -183,20 +183,20 @@ fn handleSetGeometry(listener: *wl.Listener(void)) void {
     const override_redirect: *XwaylandOverrideRedirect = @fieldParentPtr("set_geometry", listener);
 
     override_redirect.surface_tree.?.node.setPosition(
-        override_redirect.xwayland_surface.x,
-        override_redirect.xwayland_surface.y,
+        override_redirect.xsurface.x,
+        override_redirect.xsurface.y,
     );
 }
 
 fn handleSetOverrideRedirect(listener: *wl.Listener(void)) void {
     const override_redirect: *XwaylandOverrideRedirect = @fieldParentPtr("set_override_redirect", listener);
-    const xwayland_surface = override_redirect.xwayland_surface;
+    const xsurface = override_redirect.xsurface;
 
     log.debug("xwayland surface unset override redirect", .{});
 
-    assert(!xwayland_surface.override_redirect);
+    assert(!xsurface.override_redirect);
 
-    if (xwayland_surface.surface) |surface| {
+    if (xsurface.surface) |surface| {
         if (surface.mapped) {
             handleUnmap(&override_redirect.unmap);
         }
@@ -204,7 +204,7 @@ fn handleSetOverrideRedirect(listener: *wl.Listener(void)) void {
     }
     handleDestroy(&override_redirect.destroy);
 
-    XwaylandWindow.create(xwayland_surface) catch {
+    XwaylandWindow.create(xsurface) catch {
         log.err("out of memory", .{});
         return;
     };
diff --git a/river/XwaylandWindow.zig b/river/XwaylandWindow.zig
index 97a28b0..34dba95 100644
--- a/river/XwaylandWindow.zig
+++ b/river/XwaylandWindow.zig
@@ -35,7 +35,7 @@ const log = std.log.scoped(.xwayland);
 /// TODO(zig): get rid of this and use @fieldParentPtr(), https://github.com/ziglang/zig/issues/6611
 window: *Window,
 
-xwayland_surface: *wlr.XwaylandSurface,
+xsurface: *wlr.XwaylandSurface,
 /// Created on map and destroyed on unmap
 surface_tree: ?*wlr.SceneTree = null,
 
@@ -53,122 +53,122 @@ request_fullscreen: wl.Listener(void) = wl.Listener(void).init(handleRequestFull
 request_minimize: wl.Listener(*wlr.XwaylandSurface.event.Minimize) =
     wl.Listener(*wlr.XwaylandSurface.event.Minimize).init(handleRequestMinimize),
 
-// Active while the xwayland_surface is associated with a wlr_surface
+// Active while the xsurfaceis associated with a wlr_surface
 map: wl.Listener(void) = wl.Listener(void).init(handleMap),
 unmap: wl.Listener(void) = wl.Listener(void).init(handleUnmap),
 
-pub fn create(xwayland_surface: *wlr.XwaylandSurface) error{OutOfMemory}!void {
-    const window = try Window.create(.{ .xwayland_window = .{
+pub fn create(xsurface: *wlr.XwaylandSurface) error{OutOfMemory}!void {
+    const window = try Window.create(.{ .xwayland = .{
         .window = undefined,
-        .xwayland_surface = xwayland_surface,
+        .xsurface = xsurface,
     } });
     errdefer window.destroy(.assert);
 
-    const xwayland_window = &window.impl.xwayland_window;
-    xwayland_window.window = window;
+    const xwindow = &window.impl.xwayland;
+    xwindow.window = window;
 
     // Add listeners that are active over the window's entire lifetime
-    xwayland_surface.events.destroy.add(&xwayland_window.destroy);
-    xwayland_surface.events.associate.add(&xwayland_window.associate);
-    xwayland_surface.events.dissociate.add(&xwayland_window.dissociate);
-    xwayland_surface.events.request_configure.add(&xwayland_window.request_configure);
-    xwayland_surface.events.set_override_redirect.add(&xwayland_window.set_override_redirect);
-    xwayland_surface.events.set_title.add(&xwayland_window.set_title);
-    xwayland_surface.events.set_class.add(&xwayland_window.set_class);
-    xwayland_surface.events.set_decorations.add(&xwayland_window.set_decorations);
-    xwayland_surface.events.request_fullscreen.add(&xwayland_window.request_fullscreen);
-    xwayland_surface.events.request_minimize.add(&xwayland_window.request_minimize);
-
-    if (xwayland_surface.surface) |surface| {
-        handleAssociate(&xwayland_window.associate);
+    xsurface.events.destroy.add(&xwindow.destroy);
+    xsurface.events.associate.add(&xwindow.associate);
+    xsurface.events.dissociate.add(&xwindow.dissociate);
+    xsurface.events.request_configure.add(&xwindow.request_configure);
+    xsurface.events.set_override_redirect.add(&xwindow.set_override_redirect);
+    xsurface.events.set_title.add(&xwindow.set_title);
+    xsurface.events.set_class.add(&xwindow.set_class);
+    xsurface.events.set_decorations.add(&xwindow.set_decorations);
+    xsurface.events.request_fullscreen.add(&xwindow.request_fullscreen);
+    xsurface.events.request_minimize.add(&xwindow.request_minimize);
+
+    if (xsurface.surface) |surface| {
+        handleAssociate(&xwindow.associate);
         if (surface.mapped) {
-            handleMap(&xwayland_window.map);
+            handleMap(&xwindow.map);
         }
     }
 }
 
 /// Always returns false as we do not care about frame perfection for Xwayland windows.
-pub fn configure(xwayland_window: XwaylandWindow) bool {
-    const inflight = &xwayland_window.window.inflight;
-    const current = &xwayland_window.window.current;
-
-    if (xwayland_window.xwayland_surface.x == inflight.box.x and
-        xwayland_window.xwayland_surface.y == inflight.box.y and
-        xwayland_window.xwayland_surface.width == inflight.box.width and
-        xwayland_window.xwayland_surface.height == inflight.box.height and
+pub fn configure(xwindow: XwaylandWindow) bool {
+    const inflight = &xwindow.window.inflight;
+    const current = &xwindow.window.current;
+
+    if (xwindow.xsurface.x == inflight.box.x and
+        xwindow.xsurface.y == inflight.box.y and
+        xwindow.xsurface.width == inflight.box.width and
+        xwindow.xsurface.height == inflight.box.height and
         (inflight.focus != 0) == (current.focus != 0))
         // TODO fullscreen
     {
         return false;
     }
 
-    xwayland_window.xwayland_surface.configure(
+    xwindow.xsurface.configure(
         math.lossyCast(i16, inflight.box.x),
         math.lossyCast(i16, inflight.box.y),
         math.lossyCast(u16, inflight.box.width),
         math.lossyCast(u16, inflight.box.height),
     );
 
-    xwayland_window.setActivated(inflight.focus != 0);
+    xwindow.setActivated(inflight.focus != 0);
 
-    if (false) xwayland_window.xwayland_surface.setFullscreen();
+    if (false) xwindow.xsurface.setFullscreen();
 
     return false;
 }
 
-fn setActivated(xwayland_window: XwaylandWindow, activated: bool) void {
+fn setActivated(xwindow: XwaylandWindow, activated: bool) void {
     // See comment on handleRequestMinimize() for details
-    if (activated and xwayland_window.xwayland_surface.minimized) {
-        xwayland_window.xwayland_surface.setMinimized(false);
+    if (activated and xwindow.xsurface.minimized) {
+        xwindow.xsurface.setMinimized(false);
     }
-    xwayland_window.xwayland_surface.activate(activated);
+    xwindow.xsurface.activate(activated);
     if (activated) {
-        xwayland_window.xwayland_surface.restack(null, .above);
+        xwindow.xsurface.restack(null, .above);
     }
 }
 
 fn handleDestroy(listener: *wl.Listener(void)) void {
-    const xwayland_window: *XwaylandWindow = @fieldParentPtr("destroy", listener);
+    const xwindow: *XwaylandWindow = @fieldParentPtr("destroy", listener);
 
     // Remove listeners that are active for the entire lifetime of the window
-    xwayland_window.destroy.link.remove();
-    xwayland_window.associate.link.remove();
-    xwayland_window.dissociate.link.remove();
-    xwayland_window.request_configure.link.remove();
-    xwayland_window.set_override_redirect.link.remove();
-    xwayland_window.set_title.link.remove();
-    xwayland_window.set_class.link.remove();
-    xwayland_window.set_decorations.link.remove();
-    xwayland_window.request_fullscreen.link.remove();
-    xwayland_window.request_minimize.link.remove();
-
-    const window = xwayland_window.window;
+    xwindow.destroy.link.remove();
+    xwindow.associate.link.remove();
+    xwindow.dissociate.link.remove();
+    xwindow.request_configure.link.remove();
+    xwindow.set_override_redirect.link.remove();
+    xwindow.set_title.link.remove();
+    xwindow.set_class.link.remove();
+    xwindow.set_decorations.link.remove();
+    xwindow.request_fullscreen.link.remove();
+    xwindow.request_minimize.link.remove();
+
+    const window = xwindow.window;
     window.impl = .none;
     window.destroy(.lazy);
 }
 
 fn handleAssociate(listener: *wl.Listener(void)) void {
-    const xwayland_window: *XwaylandWindow = @fieldParentPtr("associate", listener);
+    const xwindow: *XwaylandWindow = @fieldParentPtr("associate", listener);
 
-    xwayland_window.xwayland_surface.surface.?.events.map.add(&xwayland_window.map);
-    xwayland_window.xwayland_surface.surface.?.events.unmap.add(&xwayland_window.unmap);
+    xwindow.xsurface.surface.?.events.map.add(&xwindow.map);
+    xwindow.xsurface.surface.?.events.unmap.add(&xwindow.unmap);
 }
 
 fn handleDissociate(listener: *wl.Listener(void)) void {
-    const xwayland_window: *XwaylandWindow = @fieldParentPtr("dissociate", listener);
-    xwayland_window.map.link.remove();
-    xwayland_window.unmap.link.remove();
+    const xwindow: *XwaylandWindow = @fieldParentPtr("dissociate", listener);
+    xwindow.map.link.remove();
+    xwindow.unmap.link.remove();
 }
 
 pub fn handleMap(listener: *wl.Listener(void)) void {
-    const xwayland_window: *XwaylandWindow = @fieldParentPtr("map", listener);
-    const window = xwayland_window.window;
+    const xwindow: *XwaylandWindow = @fieldParentPtr("map", listener);
+    const window = xwindow.window;
 
-    const xwayland_surface = xwayland_window.xwayland_surface;
-    const surface = xwayland_surface.surface.?;
+    const xsurface = xwindow.xsurface;
+    const surface = xsurface.surface.?;
     surface.data = @intFromPtr(&window.tree.node);
 
-    xwayland_window.surface_tree = window.surface_tree.createSceneSubsurfaceTree(surface) catch {
+    xwindow.surface_tree = window.surface_tree.createSceneSubsurfaceTree(surface) catch {
         log.err("out of memory", .{});
         surface.resource.getClient().postNoMemory();
         return;
@@ -178,8 +178,8 @@ pub fn handleMap(listener: *wl.Listener(void)) void {
     window.pending.box = .{
         .x = 0,
         .y = 0,
-        .width = xwayland_window.xwayland_surface.width,
-        .height = xwayland_window.xwayland_surface.height,
+        .width = xwindow.xsurface.width,
+        .height = xwindow.xsurface.height,
     };
     window.inflight.box = window.pending.box;
     window.current.box = window.pending.box;
@@ -191,85 +191,80 @@ pub fn handleMap(listener: *wl.Listener(void)) void {
 }
 
 fn handleUnmap(listener: *wl.Listener(void)) void {
-    const xwayland_window: *XwaylandWindow = @fieldParentPtr("unmap", listener);
+    const xwindow: *XwaylandWindow = @fieldParentPtr("unmap", listener);
 
-    xwayland_window.xwayland_surface.surface.?.data = 0;
+    xwindow.xsurface.surface.?.data = 0;
 
-    xwayland_window.window.unmap();
+    xwindow.window.unmap();
 
     // Don't destroy the surface tree until after Window.unmap() has a chance
     // to save buffers for frame perfection.
-    xwayland_window.surface_tree.?.node.destroy();
-    xwayland_window.surface_tree = null;
+    xwindow.surface_tree.?.node.destroy();
+    xwindow.surface_tree = null;
 }
 
 fn handleRequestConfigure(
     listener: *wl.Listener(*wlr.XwaylandSurface.event.Configure),
     event: *wlr.XwaylandSurface.event.Configure,
 ) void {
-    const xwayland_window: *XwaylandWindow = @fieldParentPtr("request_configure", listener);
+    const xwindow: *XwaylandWindow = @fieldParentPtr("request_configure", listener);
 
     // If unmapped, let the client do whatever it wants
-    if (xwayland_window.xwayland_surface.surface == null or
-        !xwayland_window.xwayland_surface.surface.?.mapped)
-    {
-        xwayland_window.xwayland_surface.configure(event.x, event.y, event.width, event.height);
+    if (xwindow.xsurface.surface == null or !xwindow.xsurface.surface.?.mapped) {
+        xwindow.xsurface.configure(event.x, event.y, event.width, event.height);
         return;
     }
 
     // Allow xwayland windows to set their own dimensions (but not position) if floating
-    xwayland_window.window.pending.box.width = event.width;
-    xwayland_window.window.pending.box.height = event.height;
+    xwindow.window.pending.box.width = event.width;
+    xwindow.window.pending.box.height = event.height;
     server.wm.dirtyPending();
 }
 
 fn handleSetOverrideRedirect(listener: *wl.Listener(void)) void {
-    const xwayland_window: *XwaylandWindow = @fieldParentPtr("set_override_redirect", listener);
-    const xwayland_surface = xwayland_window.xwayland_surface;
+    const xwindow: *XwaylandWindow = @fieldParentPtr("set_override_redirect", listener);
 
     log.debug("xwayland surface set override redirect", .{});
 
-    assert(xwayland_surface.override_redirect);
+    assert(xwindow.xsurface.override_redirect);
 
-    if (xwayland_surface.surface) |surface| {
+    if (xwindow.xsurface.surface) |surface| {
         if (surface.mapped) {
-            handleUnmap(&xwayland_window.unmap);
+            handleUnmap(&xwindow.unmap);
         }
-        handleDissociate(&xwayland_window.dissociate);
+        handleDissociate(&xwindow.dissociate);
     }
-    handleDestroy(&xwayland_window.destroy);
+    handleDestroy(&xwindow.destroy);
 
-    XwaylandOverrideRedirect.create(xwayland_surface) catch {
+    XwaylandOverrideRedirect.create(xwindow.xsurface) catch {
         log.err("out of memory", .{});
         return;
     };
 }
 
 fn handleSetTitle(listener: *wl.Listener(void)) void {
-    const xwayland_window: *XwaylandWindow = @fieldParentPtr("set_title", listener);
-    xwayland_window.window.notifyTitle();
+    const xwindow: *XwaylandWindow = @fieldParentPtr("set_title", listener);
+    xwindow.window.notifyTitle();
 }
 
 fn handleSetClass(listener: *wl.Listener(void)) void {
-    const xwayland_window: *XwaylandWindow = @fieldParentPtr("set_class", listener);
-    xwayland_window.window.notifyAppId();
+    const xwindow: *XwaylandWindow = @fieldParentPtr("set_class", listener);
+    xwindow.window.notifyAppId();
 }
 
 fn handleSetDecorations(listener: *wl.Listener(void)) void {
-    const xwayland_window: *XwaylandWindow = @fieldParentPtr("set_decorations", listener);
+    const xwindow: *XwaylandWindow = @fieldParentPtr("set_decorations", listener);
 
-    if (xwayland_window.xwayland_surface.decorations.no_border or
-        xwayland_window.xwayland_surface.decorations.no_title)
-    {
-        xwayland_window.window.setDecorationHint(.prefers_csd);
+    if (xwindow.xsurface.decorations.no_border or xwindow.xsurface.decorations.no_title) {
+        xwindow.window.setDecorationHint(.prefers_csd);
     } else {
-        xwayland_window.window.setDecorationHint(.prefers_ssd);
+        xwindow.window.setDecorationHint(.prefers_ssd);
     }
 }
 
 fn handleRequestFullscreen(listener: *wl.Listener(void)) void {
-    const xwayland_window: *XwaylandWindow = @fieldParentPtr("request_fullscreen", listener);
-    xwayland_window.window.setFullscreenRequested(xwayland_window.xwayland_surface.fullscreen);
+    const xwindow: *XwaylandWindow = @fieldParentPtr("request_fullscreen", listener);
+    xwindow.window.setFullscreenRequested(xwindow.xsurface.fullscreen);
 }
 
 /// Some X11 clients will minimize themselves regardless of how we respond.
@@ -280,6 +275,6 @@ fn handleRequestMinimize(
     listener: *wl.Listener(*wlr.XwaylandSurface.event.Minimize),
     event: *wlr.XwaylandSurface.event.Minimize,
 ) void {
-    const xwayland_window: *XwaylandWindow = @fieldParentPtr("request_minimize", listener);
-    xwayland_window.xwayland_surface.setMinimized(event.minimize);
+    const xwindow: *XwaylandWindow = @fieldParentPtr("request_minimize", listener);
+    xwindow.xsurface.setMinimized(event.minimize);
 }