Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git
river: remove tags
river/Cursor.zig | 2 --
river/IdleInhibitManager.zig | 10 +++-------
river/Output.zig | 16 ----------------
river/Root.zig | 26 ++++----------------------
river/Seat.zig | 23 ++---------------------
river/View.zig | 5 -----
river/XdgToplevel.zig | 6 ------
7 files changed, 9 insertions(+), 79 deletions(-)
diff --git a/river/Cursor.zig b/river/Cursor.zig
index 84d357a..c5ee407 100644
--- a/river/Cursor.zig
+++ b/river/Cursor.zig
@@ -982,8 +982,6 @@ pub fn updateState(cursor: *Cursor) void {
inline .move, .resize => |data, mode| {
// These conditions are checked in Root.applyPending()
- const output = data.view.current.output orelse return;
- assert(data.view.current.tags & output.current.tags != 0);
assert(!data.view.current.fullscreen);
// Keep the cursor locked to the original offset from the edges of the view.
diff --git a/river/IdleInhibitManager.zig b/river/IdleInhibitManager.zig
index 475d833..73a0141 100644
--- a/river/IdleInhibitManager.zig
+++ b/river/IdleInhibitManager.zig
@@ -53,13 +53,9 @@ pub fn checkActive(inhibit_manager: *IdleInhibitManager) void {
while (it) |node| : (it = node.next) {
const node_data = SceneNodeData.fromSurface(node.data.wlr_inhibitor.surface) orelse continue;
switch (node_data.data) {
- .view => |view| {
- if (view.current.output != null and
- view.current.tags & view.current.output.?.current.tags != 0)
- {
- inhibited = true;
- break;
- }
+ .view => {
+ inhibited = true;
+ break;
},
.layer_surface => |layer_surface| {
if (layer_surface.wlr_layer_surface.surface.mapped) {
diff --git a/river/Output.zig b/river/Output.zig
index daaa20d..c6c3011 100644
--- a/river/Output.zig
+++ b/river/Output.zig
@@ -39,23 +39,14 @@ const Config = @import("Config.zig");
const log = std.log.scoped(.output);
pub const PendingState = struct {
- /// A bit field of focused tags
- tags: u32 = 1 << 0,
/// The stack of views in focus/rendering order.
///
- /// This contains views that aren't currently visible because they do not
- /// match the tags of the output.
- ///
/// This list is used to update the rendering order of nodes in the scene
/// graph when the pending state is committed.
focus_stack: wl.list.Head(View, .pending_focus_stack_link),
/// The stack of views acted upon by window management commands such
/// as focus-view, zoom, etc.
///
- /// This contains views that aren't currently visible because they do not
- /// match the tags of the output. This means that a filtered version of the
- /// list must be used for window management commands.
- ///
/// This includes both floating/fullscreen views and those arranged in the layout.
wm_stack: wl.list.Head(View, .pending_wm_stack_link),
};
@@ -140,8 +131,6 @@ pending: PendingState,
/// This state is immutable until all clients have replied and the transaction
/// is completed, at which point this inflight state is copied to current.
inflight: struct {
- /// A bit field of focused tags
- tags: u32 = 1 << 0,
/// See pending.focus_stack
focus_stack: wl.list.Head(View, .inflight_focus_stack_link),
/// See pending.wm_stack
@@ -155,15 +144,10 @@ inflight: struct {
/// information is transferred from the inflight state to the scene graph
/// as an inflight transaction completes.
current: struct {
- /// A bit field of focused tags
- tags: u32 = 1 << 0,
/// The currently fullscreen view, if any.
fullscreen: ?*View = null,
} = .{},
-/// Remembered version of tags (from last run)
-previous_tags: u32 = 1 << 0,
-
destroy: wl.Listener(*wlr.Output) = wl.Listener(*wlr.Output).init(handleDestroy),
request_state: wl.Listener(*wlr.Output.event.RequestState) = wl.Listener(*wlr.Output.event.RequestState).init(handleRequestState),
frame: wl.Listener(*wlr.Output) = wl.Listener(*wlr.Output).init(handleFrame),
diff --git a/river/Root.zig b/river/Root.zig
index 76af321..4f043d9 100644
--- a/river/Root.zig
+++ b/river/Root.zig
@@ -68,7 +68,7 @@ hidden: struct {
},
},
-/// This is used to store views and tags when no actual outputs are available.
+/// This is used to store views when no actual outputs are available.
/// This must be separate from hidden to ensure we don't mix views that are
/// in the process of being mapped/unmapped with the mapped views in these lists.
/// There is no need for inflight lists, instead the inflight links of views are
@@ -310,9 +310,6 @@ pub fn deactivateOutput(root: *Root, output: *Output) void {
while (it.next()) |view| view.pending.output = null;
root.fallback_pending.focus_stack.prependList(&output.pending.focus_stack);
root.fallback_pending.wm_stack.prependList(&output.pending.wm_stack);
- // Store the focused output tags if we are hotplugged down to
- // 0 real outputs so they can be restored on gaining a new output.
- root.fallback_pending.tags = output.pending.tags;
}
// Close all layer surfaces on the removed output
@@ -371,7 +368,6 @@ pub fn activateOutput(root: *Root, output: *Output) void {
const log = std.log.scoped(.output_manager);
log.debug("moving views from fallback stacks to new output", .{});
- output.pending.tags = root.fallback_pending.tags;
{
var it = root.fallback_pending.wm_stack.safeIterator(.reverse);
while (it.next()) |view| view.setPendingOutput(output);
@@ -474,9 +470,7 @@ pub fn applyPending(root: *Root) void {
view.pending.clampToOutput();
}
- if (output.inflight.fullscreen == null and view.pending.fullscreen and
- view.pending.tags & output.pending.tags != 0)
- {
+ if (output.inflight.fullscreen == null and view.pending.fullscreen) {
output.inflight.fullscreen = view;
}
@@ -494,8 +488,6 @@ pub fn applyPending(root: *Root) void {
output.inflight.wm_stack.append(view);
}
}
-
- output.inflight.tags = output.pending.tags;
}
}
@@ -508,7 +500,6 @@ pub fn applyPending(root: *Root) void {
.passthrough, .down => {},
inline .move, .resize => |data| {
if (data.view.inflight.output == null or
- data.view.inflight.tags & data.view.inflight.output.?.inflight.tags == 0 or
data.view.inflight.fullscreen)
{
cursor.mode = .passthrough;
@@ -603,14 +594,6 @@ fn commitTransaction(root: *Root) void {
var output_it = root.active_outputs.iterator(.forward);
while (output_it.next()) |output| {
- if (output.inflight.tags != output.current.tags) {
- std.log.scoped(.output).debug(
- "changing current focus: {b:0>10} to {b:0>10}",
- .{ output.current.tags, output.inflight.tags },
- );
- }
- output.current.tags = output.inflight.tags;
-
var focus_stack_it = output.inflight.focus_stack.iterator(.forward);
while (focus_stack_it.next()) |view| {
assert(view.inflight.output == output);
@@ -632,9 +615,8 @@ fn commitTransaction(root: *Root) void {
view.commitTransaction();
- const enabled = view.current.tags & output.current.tags != 0;
- view.tree.node.setEnabled(enabled);
- view.popup_tree.node.setEnabled(enabled);
+ view.tree.node.setEnabled(true);
+ view.popup_tree.node.setEnabled(true);
if (output.inflight.fullscreen != view) {
// TODO this approach for syncing the order will likely cause over-damaging.
view.tree.node.lowerToBottom();
diff --git a/river/Seat.zig b/river/Seat.zig
index a730bd2..b01b5fe 100644
--- a/river/Seat.zig
+++ b/river/Seat.zig
@@ -173,36 +173,17 @@ pub fn focus(seat: *Seat, _target: ?*View) void {
}
if (target) |view| {
- if (view.pending.output == null or
- view.pending.tags & view.pending.output.?.pending.tags == 0)
- {
- // If the view is not currently visible, behave as if null was passed
- target = null;
- } else if (view.pending.output.? != seat.focused_output.?) {
+ if (view.pending.output.? != seat.focused_output.?) {
// If the view is not on the currently focused output, focus it
seat.focusOutput(view.pending.output.?);
}
}
- {
- var it = seat.focused_output.?.pending.focus_stack.iterator(.forward);
- while (it.next()) |view| {
- if (view.pending.fullscreen and
- view.pending.tags & seat.focused_output.?.pending.tags != 0)
- {
- target = view;
- break;
- }
- }
- }
-
// If null, set the target to the first currently visible view in the focus stack if any
if (target == null) {
var it = seat.focused_output.?.pending.focus_stack.iterator(.forward);
target = while (it.next()) |view| {
- if (view.pending.tags & seat.focused_output.?.pending.tags != 0) {
- break view;
- }
+ break view;
} else null;
}
diff --git a/river/View.zig b/river/View.zig
index 45d1f1c..53e021b 100644
--- a/river/View.zig
+++ b/river/View.zig
@@ -63,9 +63,6 @@ pub const State = struct {
/// The output-relative coordinates of the view and dimensions requested by river.
box: wlr.Box = .{ .x = 0, .y = 0, .width = 0, .height = 0 },
- /// The tags of the view, as a bitmask
- tags: u32 = 0,
-
/// Number of seats currently focusing the view
focus: u32 = 0,
@@ -580,8 +577,6 @@ pub fn map(view: *View) !void {
view.pending.box.y = @divTrunc(@max(0, o.usable_box.height - view.pending.box.height), 2);
}
- view.pending.tags = if (output) |o| o.pending.tags else server.root.fallback_pending.tags;
-
if (output) |o| {
view.setPendingOutput(o);
diff --git a/river/XdgToplevel.zig b/river/XdgToplevel.zig
index b27036a..d9bfd7e 100644
--- a/river/XdgToplevel.zig
+++ b/river/XdgToplevel.zig
@@ -426,9 +426,6 @@ fn handleRequestMove(
if (view.pending.fullscreen) return;
- if (view.current.output) |current_output| {
- if (view.current.tags & current_output.current.tags == 0) return;
- }
if (!view.pending.float) return;
// Moving windows with touch or tablet tool is not yet supported.
@@ -447,9 +444,6 @@ fn handleRequestResize(listener: *wl.Listener(*wlr.XdgToplevel.event.Resize), ev
if (view.pending.fullscreen) return;
- if (view.current.output) |current_output| {
- if (view.current.tags & current_output.current.tags == 0) return;
- }
if (!view.pending.float) return;
// Resizing windows with touch or tablet tool is not yet supported.