render: draw popups over borders

This commit is contained in:
Isaac Freund 2021-01-05 20:05:35 +01:00
parent 9d76709713
commit b73cb7bb69
No known key found for this signature in database
GPG key ID: 86DED400DDFD7A11
5 changed files with 19 additions and 26 deletions

View file

@ -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 => {},
}
}

View file

@ -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;
}

View file

@ -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

View file

@ -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 {

View file

@ -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).?;