The window always_on_top() function doesn't keep window on top
Author: sidwellrCreated Jul 28, 2026Updated Jul 29, 2026
The window function always_on_top() is supposed to set the window to always be on top of the others. But it doesn't. Here is some code to demonstrate this:
use nannou::prelude::*;
fn main() {
nannou::app(model).update(update).run();
}
struct Model {}
fn model(app: &App) -> Model {
let _win1 = app.new_window()
.always_on_top(true)
.view(view1)
.size(200, 200)
.build();
let _win2 = app.new_window()
.view(view2)
.size(200, 200)
.build();
Model {}
}
fn update(_app: &App, _model: &mut Model) {}
fn view1(app: &App, _model: &Model) {
let draw = app.draw();
draw.background().color(STEEL_BLUE);
}
fn view2(app: &App, _model: &Model) {
let draw = app.draw();
draw.background().color(PEACHPUFF);
}The blue window should always be on top, but doesn't have that attribute set. A similar program works correctly in nannou 0.18.1. (For some reason, it works backwards in nannou 0.19.0, always keeping the window at the bottom instead of the top. But I don't expect that to be corrected since it is an old version.)
Source: nannou-org/nannou