render: floating as normal, focused views on top

This means that floating views can be (partially) obscured by normal
views if they are low in the stack, and that the "full" layout will
work a little nicer as the focused view is always the top rendered.
This commit is contained in:
Isaac Freund 2020-06-11 00:09:42 +02:00
parent 1b7c1c7b2c
commit ff219c7d8d
No known key found for this signature in database
GPG Key ID: 86DED400DDFD7A11

View File

@ -39,6 +39,7 @@ 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);
@ -64,20 +65,26 @@ pub fn renderOutput(output: *Output) void {
var 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;
}
// Floating views are rendered on top of normal views
if (view.floating) {
// 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;
}
renderView(output.*, view, &now);
renderBorders(output.*, view, &now);
}
// Render floating views
// Render focused views
it = ViewStack(View).reverseIterator(output.views.last, output.current_focused_tags);
while (it.next()) |node| {
const view = &node.view;
@ -86,7 +93,12 @@ pub fn renderOutput(output: *Output) void {
if (view.current_box.width == 0 or view.current_box.height == 0) {
continue;
}
if (!view.floating) {
// 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);