Xwayland: Rename XwaylandUnmanaged to XwaylandOverrideRedirect
This commit is contained in:
parent
1e3b8ed161
commit
03e8da669c
@ -37,7 +37,7 @@ const Output = @import("Output.zig");
|
||||
const Seat = @import("Seat.zig");
|
||||
const View = @import("View.zig");
|
||||
const ViewStack = @import("view_stack.zig").ViewStack;
|
||||
const XwaylandUnmanaged = @import("XwaylandUnmanaged.zig");
|
||||
const XwaylandOverrideRedirect = @import("XwaylandOverrideRedirect.zig");
|
||||
|
||||
const Mode = union(enum) {
|
||||
passthrough: void,
|
||||
@ -315,9 +315,9 @@ fn handleButton(listener: *wl.Listener(*wlr.Pointer.event.Button), event: *wlr.P
|
||||
self.seat.focus(null);
|
||||
}
|
||||
},
|
||||
.xwayland_unmanaged => |xwayland_unmanaged| {
|
||||
.xwayland_override_redirect => |override_redirect| {
|
||||
if (build_options.xwayland) {
|
||||
self.seat.setFocusRaw(.{ .xwayland_unmanaged = xwayland_unmanaged });
|
||||
self.seat.setFocusRaw(.{ .xwayland_override_redirect = override_redirect });
|
||||
} else {
|
||||
unreachable;
|
||||
}
|
||||
@ -537,7 +537,7 @@ const SurfaceAtResult = struct {
|
||||
parent: union(enum) {
|
||||
view: *View,
|
||||
layer_surface: *LayerSurface,
|
||||
xwayland_unmanaged: if (build_options.xwayland) *XwaylandUnmanaged else void,
|
||||
xwayland_override_redirect: if (build_options.xwayland) *XwaylandOverrideRedirect else void,
|
||||
},
|
||||
};
|
||||
|
||||
@ -565,21 +565,21 @@ pub fn surfaceAt(self: Self) ?SurfaceAtResult {
|
||||
//
|
||||
// fullscreen:
|
||||
// 1. overlay layer toplevels and popups
|
||||
// 2. xwayland unmanaged stuff
|
||||
// 2. xwayland override redirect windows
|
||||
// 3. fullscreen view toplevels and popups
|
||||
//
|
||||
// non-fullscreen:
|
||||
// 1. overlay layer toplevels and popups
|
||||
// 2. top, bottom, background layer popups
|
||||
// 3. top layer toplevels
|
||||
// 4. xwayland unmanaged stuff
|
||||
// 4. xwayland override redirect windows
|
||||
// 5. view toplevels and popups
|
||||
// 6. bottom, background layer toplevels
|
||||
|
||||
if (layerSurfaceAt(output.getLayer(.overlay).*, ox, oy)) |s| return s;
|
||||
|
||||
if (fullscreen_view) |view| {
|
||||
if (build_options.xwayland) if (xwaylandUnmanagedSurfaceAt(lx, ly)) |s| return s;
|
||||
if (build_options.xwayland) if (xwaylandOverrideRedirectSurfaceAt(lx, ly)) |s| return s;
|
||||
var sx: f64 = undefined;
|
||||
var sy: f64 = undefined;
|
||||
if (view.surfaceAt(ox, oy, &sx, &sy)) |found| {
|
||||
@ -597,7 +597,7 @@ pub fn surfaceAt(self: Self) ?SurfaceAtResult {
|
||||
|
||||
if (layerSurfaceAt(output.getLayer(.top).*, ox, oy)) |s| return s;
|
||||
|
||||
if (build_options.xwayland) if (xwaylandUnmanagedSurfaceAt(lx, ly)) |s| return s;
|
||||
if (build_options.xwayland) if (xwaylandOverrideRedirectSurfaceAt(lx, ly)) |s| return s;
|
||||
|
||||
if (viewSurfaceAt(output, ox, oy)) |s| return s;
|
||||
|
||||
@ -721,8 +721,8 @@ fn viewSurfaceAt(output: *const Output, ox: f64, oy: f64) ?SurfaceAtResult {
|
||||
return null;
|
||||
}
|
||||
|
||||
fn xwaylandUnmanagedSurfaceAt(lx: f64, ly: f64) ?SurfaceAtResult {
|
||||
var it = server.root.xwayland_unmanaged_views.first;
|
||||
fn xwaylandOverrideRedirectSurfaceAt(lx: f64, ly: f64) ?SurfaceAtResult {
|
||||
var it = server.root.xwayland_override_redirect_views.first;
|
||||
while (it) |node| : (it = node.next) {
|
||||
const xwayland_surface = node.data.xwayland_surface;
|
||||
var sx: f64 = undefined;
|
||||
@ -737,7 +737,7 @@ fn xwaylandUnmanagedSurfaceAt(lx: f64, ly: f64) ?SurfaceAtResult {
|
||||
.surface = found,
|
||||
.sx = sx,
|
||||
.sy = sy,
|
||||
.parent = .{ .xwayland_unmanaged = &node.data },
|
||||
.parent = .{ .xwayland_override_redirect = &node.data },
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -912,7 +912,7 @@ pub fn checkFocusFollowsCursor(self: *Self) void {
|
||||
}
|
||||
},
|
||||
.layer_surface => {},
|
||||
.xwayland_unmanaged => assert(build_options.xwayland),
|
||||
.xwayland_override_redirect => assert(build_options.xwayland),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -28,7 +28,7 @@ const util = @import("util.zig");
|
||||
const Output = @import("Output.zig");
|
||||
const View = @import("View.zig");
|
||||
const ViewStack = @import("view_stack.zig").ViewStack;
|
||||
const XwaylandUnmanaged = @import("XwaylandUnmanaged.zig");
|
||||
const XwaylandOverrideRedirect = @import("XwaylandOverrideRedirect.zig");
|
||||
const DragIcon = @import("DragIcon.zig");
|
||||
|
||||
new_output: wl.Listener(*wlr.Output) = wl.Listener(*wlr.Output).init(handleNewOutput),
|
||||
@ -58,10 +58,10 @@ noop_output: Output = undefined,
|
||||
|
||||
drag_icons: std.SinglyLinkedList(DragIcon) = .{},
|
||||
|
||||
/// This list stores all unmanaged Xwayland windows. This needs to be in root
|
||||
/// since X is like the wild west and who knows where these things will go.
|
||||
xwayland_unmanaged_views: if (build_options.xwayland)
|
||||
std.TailQueue(XwaylandUnmanaged)
|
||||
/// This list stores all "override redirect" Xwayland windows. This needs to be in root
|
||||
/// since X is like the wild west and who knows where these things will place themselves.
|
||||
xwayland_override_redirect_views: if (build_options.xwayland)
|
||||
std.TailQueue(XwaylandOverrideRedirect)
|
||||
else
|
||||
void = if (build_options.xwayland)
|
||||
.{},
|
||||
|
@ -39,14 +39,14 @@ const Output = @import("Output.zig");
|
||||
const SeatStatus = @import("SeatStatus.zig");
|
||||
const View = @import("View.zig");
|
||||
const ViewStack = @import("view_stack.zig").ViewStack;
|
||||
const XwaylandUnmanaged = @import("XwaylandUnmanaged.zig");
|
||||
const XwaylandOverrideRedirect = @import("XwaylandOverrideRedirect.zig");
|
||||
|
||||
const log = std.log.scoped(.seat);
|
||||
const PointerConstraint = @import("PointerConstraint.zig");
|
||||
|
||||
const FocusTarget = union(enum) {
|
||||
view: *View,
|
||||
xwayland_unmanaged: *XwaylandUnmanaged,
|
||||
xwayland_override_redirect: *XwaylandOverrideRedirect,
|
||||
layer: *LayerSurface,
|
||||
none: void,
|
||||
};
|
||||
@ -210,7 +210,7 @@ fn pendingFilter(view: *View, filter_tags: u32) bool {
|
||||
|
||||
/// Switch focus to the target, handling unfocus and input inhibition
|
||||
/// properly. This should only be called directly if dealing with layers or
|
||||
/// unmanaged xwayland views.
|
||||
/// override redirect xwayland views.
|
||||
pub fn setFocusRaw(self: *Self, new_focus: FocusTarget) void {
|
||||
// If the target is already focused, do nothing
|
||||
if (std.meta.eql(new_focus, self.focused)) return;
|
||||
@ -218,9 +218,9 @@ pub fn setFocusRaw(self: *Self, new_focus: FocusTarget) void {
|
||||
// Obtain the target surface
|
||||
const target_surface = switch (new_focus) {
|
||||
.view => |target_view| target_view.surface.?,
|
||||
.xwayland_unmanaged => |target_xwayland_unmanaged| blk: {
|
||||
.xwayland_override_redirect => |target_override_redirect| blk: {
|
||||
assert(build_options.xwayland);
|
||||
break :blk target_xwayland_unmanaged.xwayland_surface.surface;
|
||||
break :blk target_override_redirect.xwayland_surface.surface;
|
||||
},
|
||||
.layer => |target_layer| target_layer.wlr_layer_surface.surface,
|
||||
.none => null,
|
||||
@ -236,7 +236,7 @@ pub fn setFocusRaw(self: *Self, new_focus: FocusTarget) void {
|
||||
view.pending.focus -= 1;
|
||||
if (view.pending.focus == 0) view.setActivated(false);
|
||||
},
|
||||
.xwayland_unmanaged, .layer, .none => {},
|
||||
.xwayland_override_redirect, .layer, .none => {},
|
||||
}
|
||||
|
||||
// Set the new focus
|
||||
@ -248,7 +248,7 @@ pub fn setFocusRaw(self: *Self, new_focus: FocusTarget) void {
|
||||
target_view.pending.urgent = false;
|
||||
},
|
||||
.layer => |target_layer| assert(self.focused_output == target_layer.output),
|
||||
.xwayland_unmanaged, .none => {},
|
||||
.xwayland_override_redirect, .none => {},
|
||||
}
|
||||
self.focused = new_focus;
|
||||
|
||||
|
@ -34,7 +34,7 @@ const Output = @import("Output.zig");
|
||||
const Root = @import("Root.zig");
|
||||
const StatusManager = @import("StatusManager.zig");
|
||||
const XdgToplevel = @import("XdgToplevel.zig");
|
||||
const XwaylandUnmanaged = @import("XwaylandUnmanaged.zig");
|
||||
const XwaylandOverrideRedirect = @import("XwaylandOverrideRedirect.zig");
|
||||
const XwaylandView = @import("XwaylandView.zig");
|
||||
const IdleInhibitorManager = @import("IdleInhibitorManager.zig");
|
||||
|
||||
@ -247,7 +247,7 @@ fn handleNewXwaylandSurface(listener: *wl.Listener(*wlr.XwaylandSurface), xwayla
|
||||
);
|
||||
|
||||
if (xwayland_surface.override_redirect) {
|
||||
_ = XwaylandUnmanaged.create(xwayland_surface) catch {
|
||||
_ = XwaylandOverrideRedirect.create(xwayland_surface) catch {
|
||||
log.err("out of memory", .{});
|
||||
return;
|
||||
};
|
||||
|
@ -47,8 +47,7 @@ set_override_redirect: wl.Listener(*wlr.XwaylandSurface) =
|
||||
// Listeners that are only active while mapped
|
||||
commit: wl.Listener(*wlr.Surface) = wl.Listener(*wlr.Surface).init(handleCommit),
|
||||
|
||||
/// The unmanged surface will add itself to the list of unmanaged views
|
||||
/// in Root when it is mapped.
|
||||
/// The override redirect surface will add itself to the list in Root when it is mapped.
|
||||
pub fn create(xwayland_surface: *wlr.XwaylandSurface) error{OutOfMemory}!*Self {
|
||||
const node = try util.gpa.create(std.TailQueue(Self).Node);
|
||||
const self = &node.data;
|
||||
@ -92,14 +91,13 @@ fn handleDestroy(listener: *wl.Listener(*wlr.XwaylandSurface), _: *wlr.XwaylandS
|
||||
pub fn handleMap(listener: *wl.Listener(*wlr.XwaylandSurface), xwayland_surface: *wlr.XwaylandSurface) void {
|
||||
const self = @fieldParentPtr(Self, "map", listener);
|
||||
|
||||
// Add self to the list of unmanaged views in the root
|
||||
const node = @fieldParentPtr(std.TailQueue(Self).Node, "data", self);
|
||||
server.root.xwayland_unmanaged_views.prepend(node);
|
||||
server.root.xwayland_override_redirect_views.prepend(node);
|
||||
|
||||
xwayland_surface.surface.?.events.commit.add(&self.commit);
|
||||
|
||||
if (self.xwayland_surface.overrideRedirectWantsFocus()) {
|
||||
server.input_manager.defaultSeat().setFocusRaw(.{ .xwayland_unmanaged = self });
|
||||
server.input_manager.defaultSeat().setFocusRaw(.{ .xwayland_override_redirect = self });
|
||||
}
|
||||
}
|
||||
|
||||
@ -107,9 +105,8 @@ pub fn handleMap(listener: *wl.Listener(*wlr.XwaylandSurface), xwayland_surface:
|
||||
fn handleUnmap(listener: *wl.Listener(*wlr.XwaylandSurface), _: *wlr.XwaylandSurface) void {
|
||||
const self = @fieldParentPtr(Self, "unmap", listener);
|
||||
|
||||
// Remove self from the list of unmanaged views in the root
|
||||
const node = @fieldParentPtr(std.TailQueue(Self).Node, "data", self);
|
||||
server.root.xwayland_unmanaged_views.remove(node);
|
||||
server.root.xwayland_override_redirect_views.remove(node);
|
||||
|
||||
self.commit.link.remove();
|
||||
|
||||
@ -118,7 +115,9 @@ fn handleUnmap(listener: *wl.Listener(*wlr.XwaylandSurface), _: *wlr.XwaylandSur
|
||||
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 == .xwayland_unmanaged and seat.focused.xwayland_unmanaged == self) {
|
||||
if (seat.focused == .xwayland_override_redirect and
|
||||
seat.focused.xwayland_override_redirect == self)
|
||||
{
|
||||
seat.focus(null);
|
||||
}
|
||||
}
|
||||
@ -137,7 +136,7 @@ fn handleSetOverrideRedirect(
|
||||
) void {
|
||||
const self = @fieldParentPtr(Self, "set_override_redirect", listener);
|
||||
|
||||
log.debug("xwayland surface unset override redirect, switching to managed", .{});
|
||||
log.debug("xwayland surface unset override redirect", .{});
|
||||
|
||||
assert(!xwayland_surface.override_redirect);
|
||||
|
@ -31,7 +31,7 @@ const Output = @import("Output.zig");
|
||||
const View = @import("View.zig");
|
||||
const ViewStack = @import("view_stack.zig").ViewStack;
|
||||
const XdgPopup = @import("XdgPopup.zig");
|
||||
const XwaylandUnmanaged = @import("XwaylandUnmanaged.zig");
|
||||
const XwaylandOverrideRedirect = @import("XwaylandOverrideRedirect.zig");
|
||||
|
||||
const log = std.log.scoped(.xwayland);
|
||||
|
||||
@ -287,20 +287,20 @@ fn handleSetOverrideRedirect(
|
||||
) void {
|
||||
const self = @fieldParentPtr(Self, "set_override_redirect", listener);
|
||||
|
||||
log.debug("xwayland surface set override redirect, switching to unmanaged", .{});
|
||||
log.debug("xwayland surface set override redirect", .{});
|
||||
|
||||
assert(xwayland_surface.override_redirect);
|
||||
|
||||
if (xwayland_surface.mapped) handleUnmap(&self.unmap, xwayland_surface);
|
||||
handleDestroy(&self.destroy, xwayland_surface);
|
||||
|
||||
const unmanaged = XwaylandUnmanaged.create(xwayland_surface) catch {
|
||||
const override_redirect = XwaylandOverrideRedirect.create(xwayland_surface) catch {
|
||||
log.err("out of memory", .{});
|
||||
return;
|
||||
};
|
||||
|
||||
if (xwayland_surface.mapped) {
|
||||
XwaylandUnmanaged.handleMap(&unmanaged.map, xwayland_surface);
|
||||
XwaylandOverrideRedirect.handleMap(&override_redirect.map, xwayland_surface);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -75,7 +75,7 @@ pub fn renderOutput(output: *Output) void {
|
||||
// Always clear with solid black for fullscreen
|
||||
server.renderer.clear(&[_]f32{ 0, 0, 0, 1 });
|
||||
renderView(output, view, &now);
|
||||
if (build_options.xwayland) renderXwaylandUnmanaged(output, &now);
|
||||
if (build_options.xwayland) renderXwaylandOverrideRedirect(output, &now);
|
||||
} else {
|
||||
// No fullscreen view, so render normal layers/views
|
||||
server.renderer.clear(&server.config.background_color);
|
||||
@ -117,7 +117,7 @@ pub fn renderOutput(output: *Output) void {
|
||||
renderView(output, view, &now);
|
||||
}
|
||||
|
||||
if (build_options.xwayland) renderXwaylandUnmanaged(output, &now);
|
||||
if (build_options.xwayland) renderXwaylandOverrideRedirect(output, &now);
|
||||
|
||||
renderLayer(output, output.getLayer(.top).*, &now, .toplevels);
|
||||
|
||||
@ -241,11 +241,11 @@ fn renderDragIcons(output: *const Output, now: *os.timespec) void {
|
||||
}
|
||||
}
|
||||
|
||||
/// Render all xwayland unmanaged windows that appear on the output
|
||||
fn renderXwaylandUnmanaged(output: *const Output, now: *os.timespec) void {
|
||||
/// Render all override redirect xwayland windows that appear on the output
|
||||
fn renderXwaylandOverrideRedirect(output: *const Output, now: *os.timespec) void {
|
||||
const output_box = server.root.output_layout.getBox(output.wlr_output).?;
|
||||
|
||||
var it = server.root.xwayland_unmanaged_views.last;
|
||||
var it = server.root.xwayland_override_redirect_views.last;
|
||||
while (it) |node| : (it = node.prev) {
|
||||
const xwayland_surface = node.data.xwayland_surface;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user