Add Window::set_window_level API
This adds `Window::set_window_level` to control the preferred z level of the window. Co-authored-by: Markus Siglreithmaier <m.siglreith@gmail.com> Co-authored-by: Kirill Chibisov <contact@kchibisov.com> Co-authored-by: Mads Marquart <mads@marquart.dk>
This commit is contained in:
parent
ba4bf03675
commit
101ac8908c
12 changed files with 142 additions and 82 deletions
|
|
@ -9,7 +9,7 @@ fn main() {
|
|||
dpi::{PhysicalPosition, PhysicalSize, Position, Size},
|
||||
event::{ElementState, Event, KeyboardInput, VirtualKeyCode, WindowEvent},
|
||||
event_loop::EventLoop,
|
||||
window::{CursorGrabMode, CursorIcon, Fullscreen, WindowBuilder},
|
||||
window::{CursorGrabMode, CursorIcon, Fullscreen, WindowBuilder, WindowLevel},
|
||||
};
|
||||
|
||||
const WINDOW_COUNT: usize = 3;
|
||||
|
|
@ -66,7 +66,9 @@ fn main() {
|
|||
let state = !modifiers.shift();
|
||||
use VirtualKeyCode::*;
|
||||
match key {
|
||||
A => window.set_always_on_top(state),
|
||||
Key1 => window.set_window_level(WindowLevel::AlwaysOnTop),
|
||||
Key2 => window.set_window_level(WindowLevel::AlwaysOnBottom),
|
||||
Key3 => window.set_window_level(WindowLevel::Normal),
|
||||
C => window.set_cursor_icon(match state {
|
||||
true => CursorIcon::Progress,
|
||||
false => CursorIcon::Default,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue