view: use saved geometry for borders if needed
This fixes the issues caused by 60f06a1
and greatly simplifies the code.
Turns out we were already tracking the dimensions needed.
This commit is contained in:
parent
5b96d831d3
commit
82a444a7c0
@ -262,16 +262,6 @@ pub fn getDefaultFloatBox(self: Self) Box {
|
|||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Return the dimensions of the actual "visible bounds" that the client has
|
|
||||||
/// committed. This excludes any "invisible" areas of the surface that show
|
|
||||||
/// useless stuff like CSD shadows.
|
|
||||||
pub fn getActualBox(self: Self) Box {
|
|
||||||
return switch (self.impl) {
|
|
||||||
.xdg_toplevel => |xdg_toplevel| xdg_toplevel.getActualBox(),
|
|
||||||
.xwayland_view => |xwayland_view| xwayland_view.getActualBox(),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Called by the impl when the surface is ready to be displayed
|
/// Called by the impl when the surface is ready to be displayed
|
||||||
pub fn map(self: *Self) void {
|
pub fn map(self: *Self) void {
|
||||||
const root = self.output.root;
|
const root = self.output.root;
|
||||||
|
@ -54,7 +54,3 @@ pub fn surfaceAt(self: Self, ox: f64, oy: f64, sx: *f64, sy: *f64) ?*c.wlr_surfa
|
|||||||
pub fn getTitle(self: Self) [*:0]const u8 {
|
pub fn getTitle(self: Self) [*:0]const u8 {
|
||||||
unreachable;
|
unreachable;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getActualBox(self: Self) Box {
|
|
||||||
unreachable;
|
|
||||||
}
|
|
||||||
|
@ -123,15 +123,6 @@ pub fn getTitle(self: Self) [*:0]const u8 {
|
|||||||
return wlr_xdg_toplevel.title orelse "NULL";
|
return wlr_xdg_toplevel.title orelse "NULL";
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getActualBox(self: Self) Box {
|
|
||||||
return .{
|
|
||||||
.x = self.wlr_xdg_surface.geometry.x,
|
|
||||||
.y = self.wlr_xdg_surface.geometry.y,
|
|
||||||
.width = @intCast(u32, self.wlr_xdg_surface.geometry.width),
|
|
||||||
.height = @intCast(u32, self.wlr_xdg_surface.geometry.height),
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Called when the xdg surface is destroyed
|
/// Called when the xdg surface is destroyed
|
||||||
fn handleDestroy(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
|
fn handleDestroy(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
|
||||||
const self = @fieldParentPtr(Self, "listen_destroy", listener.?);
|
const self = @fieldParentPtr(Self, "listen_destroy", listener.?);
|
||||||
|
@ -114,15 +114,6 @@ pub fn getTitle(self: Self) [*:0]const u8 {
|
|||||||
return self.wlr_xwayland_surface.title;
|
return self.wlr_xwayland_surface.title;
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn getActualBox(self: Self) Box {
|
|
||||||
return .{
|
|
||||||
.x = self.wlr_xwayland_surface.x,
|
|
||||||
.y = self.wlr_xwayland_surface.y,
|
|
||||||
.width = self.wlr_xwayland_surface.width,
|
|
||||||
.height = self.wlr_xwayland_surface.height,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
/// Called when the xwayland surface is destroyed
|
/// Called when the xwayland surface is destroyed
|
||||||
fn handleDestroy(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
|
fn handleDestroy(listener: ?*c.wl_listener, data: ?*c_void) callconv(.C) void {
|
||||||
const self = @fieldParentPtr(Self, "listen_destroy", listener.?);
|
const self = @fieldParentPtr(Self, "listen_destroy", listener.?);
|
||||||
|
@ -240,10 +240,11 @@ fn renderTexture(
|
|||||||
|
|
||||||
fn renderBorders(output: Output, view: *View, now: *c.timespec) void {
|
fn renderBorders(output: Output, view: *View, now: *c.timespec) void {
|
||||||
const config = &output.root.server.config;
|
const config = &output.root.server.config;
|
||||||
var border: Box = undefined;
|
|
||||||
const color = if (view.focused) &config.border_color_focused else &config.border_color_unfocused;
|
const color = if (view.focused) &config.border_color_focused else &config.border_color_unfocused;
|
||||||
const border_width = config.border_width;
|
const border_width = config.border_width;
|
||||||
const actual_box = view.getActualBox();
|
const actual_box = if (view.saved_buffers.items.len != 0) view.saved_surface_box else view.surface_box;
|
||||||
|
|
||||||
|
var border: Box = undefined;
|
||||||
|
|
||||||
// left and right, covering the corners as well
|
// left and right, covering the corners as well
|
||||||
border.y = view.current.box.y - @intCast(i32, border_width);
|
border.y = view.current.box.y - @intCast(i32, border_width);
|
||||||
|
Loading…
Reference in New Issue
Block a user