Wayland compositor (wlroots)
git clone https://git.lucas.co/cce-compositor.git
river: remove some dead code
river/Vector.zig | 58 --------------------------------------------------------
river/View.zig | 15 ---------------
2 files changed, 73 deletions(-)
diff --git a/river/Vector.zig b/river/Vector.zig
deleted file mode 100644
index 932cba9..0000000
--- a/river/Vector.zig
+++ /dev/null
@@ -1,58 +0,0 @@
-// This file is part of river, a dynamic tiling wayland compositor.
-//
-// Copyright 2023 The River Developers
-//
-// This program is free software: you can redistribute it and/or modify
-// it under the terms of the GNU General Public License as published by
-// the Free Software Foundation, either version 3 of the License, or
-// (at your option) any later version.
-//
-// This program is distributed in the hope that it will be useful,
-// but WITHOUT ANY WARRANTY; without even the implied warranty of
-// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
-// GNU General Public License for more details.
-//
-// You should have received a copy of the GNU General Public License
-// along with this program. If not, see <https://www.gnu.org/licenses/>.
-
-const std = @import("std");
-const math = std.math;
-const wlr = @import("wlroots");
-
-const Vector = @This();
-
-x: i32,
-y: i32,
-
-pub fn positionOfBox(box: wlr.Box) Vector {
- return .{
- .x = box.x + @divFloor(box.width, 2),
- .y = box.y + @divFloor(box.height, 2),
- };
-}
-
-/// Returns the difference between two vectors.
-pub fn diff(a: Vector, b: Vector) Vector {
- return .{
- .x = b.x - a.x,
- .y = b.y - a.y,
- };
-}
-
-/// Returns the direction of the vector.
-pub fn direction(v: Vector) ?wlr.OutputLayout.Direction {
- // A zero length vector has no direction
- if (v.x == 0 and v.y == 0) return null;
-
- if (@abs(v.y) > @abs(v.x)) {
- // Careful: We are operating in a Y-inverted coordinate system.
- return if (v.y > 0) .down else .up;
- } else {
- return if (v.x > 0) .right else .left;
- }
-}
-
-/// Returns the length of the vector.
-pub fn length(v: Vector) u31 {
- return math.sqrt(@as(u31, @intCast((v.x *| v.x) +| (v.y *| v.y))));
-}
diff --git a/river/View.zig b/river/View.zig
index 883e059..27a6301 100644
--- a/river/View.zig
+++ b/river/View.zig
@@ -145,19 +145,8 @@ inflight_render_list_link: wl.list.Link,
/// The current state represented by the scene graph.
current: State = .{},
-/// The floating dimensions the view, saved so that they can be restored if the
-/// view returns to floating mode.
-float_box: wlr.Box = undefined,
-
-/// This state exists purely to allow for more intuitive behavior when
-/// exiting fullscreen if there is no active layout.
-post_fullscreen_box: wlr.Box = undefined,
-
foreign_toplevel_handle: ForeignToplevelHandle = .{},
-/// Connector name of the output this view occupied before an evacuation.
-output_before_evac: ?[]const u8 = null,
-
pub fn create(impl: Impl) error{OutOfMemory}!*View {
assert(impl != .none);
@@ -222,8 +211,6 @@ pub fn destroy(view: *View, when: enum { lazy, assert }) void {
view.pending_render_list_link.remove();
view.inflight_render_list_link.remove();
- if (view.output_before_evac) |name| util.gpa.free(name);
-
util.gpa.destroy(view);
} else {
switch (when) {
@@ -505,8 +492,6 @@ pub fn map(view: *View) !void {
view.foreign_toplevel_handle.map();
- view.float_box = view.pending.box;
-
server.root.applyPending();
}