code: simplify view rendering
This commit is contained in:
parent
8839ae7335
commit
0ab2b3134e
@ -56,7 +56,7 @@ wlr_surface: ?*c.wlr_surface,
|
||||
/// If the view is floating or not
|
||||
floating: bool,
|
||||
|
||||
/// True if the view is currentlt focused by at lease one seat
|
||||
/// True if the view is currently focused by at least one seat
|
||||
focused: bool,
|
||||
|
||||
/// The current output-relative coordinates and dimensions of the view
|
||||
|
@ -39,7 +39,6 @@ const SurfaceRenderData = struct {
|
||||
|
||||
pub fn renderOutput(output: *Output) void {
|
||||
const wlr_renderer = output.getRenderer();
|
||||
const input_manager = output.root.server.input_manager;
|
||||
|
||||
var now: c.timespec = undefined;
|
||||
_ = c.clock_gettime(c.CLOCK_MONOTONIC, &now);
|
||||
@ -68,17 +67,10 @@ pub fn renderOutput(output: *Output) void {
|
||||
|
||||
// This check prevents a race condition when a frame is requested
|
||||
// between mapping of a view and the first configure being handled.
|
||||
if (view.current_box.width == 0 or view.current_box.height == 0) {
|
||||
continue;
|
||||
}
|
||||
if (view.current_box.width == 0 or view.current_box.height == 0) continue;
|
||||
|
||||
// Focused views are rendered on top of normal views, skip them for now
|
||||
var seat_it = input_manager.seats.first;
|
||||
if (while (seat_it) |seat_node| : (seat_it = seat_node.next) {
|
||||
if (seat_node.data.focused_view == view) break true;
|
||||
} else false) {
|
||||
continue;
|
||||
}
|
||||
if (view.focused) continue;
|
||||
|
||||
renderView(output.*, view, &now);
|
||||
renderBorders(output.*, view, &now);
|
||||
@ -88,19 +80,14 @@ pub fn renderOutput(output: *Output) void {
|
||||
it = ViewStack(View).reverseIterator(output.views.last, output.current_focused_tags);
|
||||
while (it.next()) |node| {
|
||||
const view = &node.view;
|
||||
|
||||
// This check prevents a race condition when a frame is requested
|
||||
// between mapping of a view and the first configure being handled.
|
||||
if (view.current_box.width == 0 or view.current_box.height == 0) {
|
||||
continue;
|
||||
}
|
||||
if (view.current_box.width == 0 or view.current_box.height == 0) continue;
|
||||
|
||||
// Skip unfocused views since we already rendered them
|
||||
if (!view.focused) continue;
|
||||
|
||||
// Skip unfocused views
|
||||
var seat_it = input_manager.seats.first;
|
||||
if (while (seat_it) |seat_node| : (seat_it = seat_node.next) {
|
||||
if (seat_node.data.focused_view == view) break false;
|
||||
} else true) {
|
||||
continue;
|
||||
}
|
||||
renderView(output.*, view, &now);
|
||||
renderBorders(output.*, view, &now);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user