aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorIsaac Freund <ifreund@ifreund.xyz>2021-01-05 20:05:35 +0100
committerIsaac Freund <ifreund@ifreund.xyz>2021-01-05 20:05:35 +0100
commitb73cb7bb6993076c0bd794df342fe8516a082a96 (patch)
tree304f9517291931abd26f541339a882b908ae7816
parent9d76709713a05991236bee606da36fbb922ccfc0 (diff)
downloadriver-b73cb7bb6993076c0bd794df342fe8516a082a96.tar.gz
river-b73cb7bb6993076c0bd794df342fe8516a082a96.tar.xz
render: draw popups over borders
-rw-r--r--river/View.zig8
-rw-r--r--river/VoidView.zig9
-rw-r--r--river/XdgToplevel.zig4
-rw-r--r--river/XwaylandView.zig10
-rw-r--r--river/render.zig14
5 files changed, 19 insertions, 26 deletions
diff --git a/river/View.zig b/river/View.zig
index 0bbe5bc..85a5b2f 100644
--- a/river/View.zig
+++ b/river/View.zig
@@ -266,7 +266,7 @@ pub fn dropSavedBuffers(self: *Self) void {
pub fn saveBuffers(self: *Self) void {
std.debug.assert(self.saved_buffers.items.len == 0);
self.saved_surface_box = self.surface_box;
- self.forEachSurface(*std.ArrayList(SavedBuffer), saveBuffersIterator, &self.saved_buffers);
+ self.surface.?.forEachSurface(*std.ArrayList(SavedBuffer), saveBuffersIterator, &self.saved_buffers);
}
/// If this commit is in response to our configure and the
@@ -332,15 +332,15 @@ pub fn close(self: Self) void {
}
}
-pub inline fn forEachSurface(
+pub inline fn forEachPopup(
self: Self,
comptime T: type,
iterator: fn (surface: *wlr.Surface, sx: c_int, sy: c_int, data: T) callconv(.C) void,
user_data: T,
) void {
switch (self.impl) {
- .xdg_toplevel => |xdg_toplevel| xdg_toplevel.forEachSurface(T, iterator, user_data),
- .xwayland_view => |xwayland_view| xwayland_view.forEachSurface(T, iterator, user_data),
+ .xdg_toplevel => |xdg_toplevel| xdg_toplevel.forEachPopup(T, iterator, user_data),
+ .xwayland_view => {},
}
}
diff --git a/river/VoidView.zig b/river/VoidView.zig
index 489169a..4fe4d7d 100644
--- a/river/VoidView.zig
+++ b/river/VoidView.zig
@@ -39,15 +39,6 @@ pub fn close(self: Self) void {
unreachable;
}
-pub fn forEachSurface(
- self: Self,
- comptime T: type,
- iterator: fn (surface: *wlr.Surface, sx: c_int, sy: c_int, data: T) callconv(.C) void,
- user_data: T,
-) void {
- unreachable;
-}
-
pub fn surfaceAt(self: Self, ox: f64, oy: f64, sx: *f64, sy: *f64) ?*wlr.Surface {
unreachable;
}
diff --git a/river/XdgToplevel.zig b/river/XdgToplevel.zig
index ddbee00..63f6c09 100644
--- a/river/XdgToplevel.zig
+++ b/river/XdgToplevel.zig
@@ -103,13 +103,13 @@ pub fn close(self: Self) void {
self.xdg_surface.role_data.toplevel.sendClose();
}
-pub inline fn forEachSurface(
+pub inline fn forEachPopup(
self: Self,
comptime T: type,
iterator: fn (surface: *wlr.Surface, sx: c_int, sy: c_int, data: T) callconv(.C) void,
user_data: T,
) void {
- self.xdg_surface.forEachSurface(T, iterator, user_data);
+ self.xdg_surface.forEachPopup(T, iterator, user_data);
}
/// Return the surface at output coordinates ox, oy and set sx, sy to the
diff --git a/river/XwaylandView.zig b/river/XwaylandView.zig
index 58ac8a6..dea66e2 100644
--- a/river/XwaylandView.zig
+++ b/river/XwaylandView.zig
@@ -87,16 +87,6 @@ pub fn close(self: Self) void {
self.xwayland_surface.close();
}
-/// Iterate over all surfaces of the xwayland view.
-pub fn forEachSurface(
- self: Self,
- comptime T: type,
- iterator: fn (surface: *wlr.Surface, sx: c_int, sy: c_int, data: T) callconv(.C) void,
- data: T,
-) void {
- self.xwayland_surface.surface.?.forEachSurface(T, iterator, data);
-}
-
/// Return the surface at output coordinates ox, oy and set sx, sy to the
/// corresponding surface-relative coordinates, if there is a surface.
pub fn surfaceAt(self: Self, ox: f64, oy: f64, sx: *f64, sy: *f64) ?*wlr.Surface {
diff --git a/river/render.zig b/river/render.zig
index 15cc005..b3af9e5 100644
--- a/river/render.zig
+++ b/river/render.zig
@@ -92,6 +92,7 @@ pub fn renderOutput(output: *Output) void {
renderView(output.*, view, &now);
if (view.draw_borders) renderBorders(output.*, view, &now);
+ renderViewPopups(output.*, view, &now);
}
if (build_options.xwayland) renderXwaylandUnmanaged(output.*, &now);
@@ -206,10 +207,21 @@ fn renderView(output: Output, view: *View, now: *os.timespec) void {
.opacity = view.opacity,
};
- view.forEachSurface(*SurfaceRenderData, renderSurfaceIterator, &rdata);
+ view.surface.?.forEachSurface(*SurfaceRenderData, renderSurfaceIterator, &rdata);
}
}
+fn renderViewPopups(output: Output, view: *View, now: *os.timespec) void {
+ var rdata = SurfaceRenderData{
+ .output = &output,
+ .output_x = view.current.box.x - view.surface_box.x,
+ .output_y = view.current.box.y - view.surface_box.y,
+ .when = now,
+ .opacity = view.opacity,
+ };
+ view.forEachPopup(*SurfaceRenderData, renderSurfaceIterator, &rdata);
+}
+
fn renderDragIcons(output: Output, now: *os.timespec) void {
const output_box = output.root.output_layout.getBox(output.wlr_output).?;