1
0
mirror of https://github.com/emilk/egui.git synced 2026-08-30 13:20:05 -04:00

Some work making the native window to look like the egui one, and to work the same

This commit is contained in:
Konkitoman
2023-07-27 15:08:21 +03:00
parent cb09e630a2
commit 0e74cf4ca0
3 changed files with 308 additions and 36 deletions

View File

@@ -513,7 +513,7 @@ impl Default for NativeOptions {
min_window_size: None,
max_window_size: None,
resizable: true,
transparent: false,
transparent: true,
mouse_passthrough: false,
active: true,

View File

@@ -424,7 +424,10 @@ mod glow_integration {
prelude::{GlDisplay, NotCurrentGlContextSurfaceAccessor, PossiblyCurrentGlContext},
surface::GlSurface,
};
use winit::dpi::{PhysicalPosition, PhysicalSize};
use winit::{
dpi::{PhysicalPosition, PhysicalSize},
window::ResizeDirection,
};
use super::*;
@@ -1252,6 +1255,45 @@ mod glow_integration {
}
}
}
egui::window::ViewportCommand::InnerSize(width, height) => {
win.set_inner_size(PhysicalSize::new(width, height));
}
egui::window::ViewportCommand::Resize(
top,
bottom,
right,
left,
) => {
win.drag_resize_window(
match (top, bottom, right, left) {
(true, false, false, false) => {
ResizeDirection::North
}
(false, true, false, false) => {
ResizeDirection::South
}
(false, false, true, false) => {
ResizeDirection::East
}
(false, false, false, true) => {
ResizeDirection::West
}
(true, false, true, false) => {
ResizeDirection::NorthEast
}
(false, true, true, false) => {
ResizeDirection::SouthEast
}
(true, false, false, true) => {
ResizeDirection::NorthWest
}
(false, true, false, true) => {
ResizeDirection::SouthWest
}
_ => ResizeDirection::East,
},
);
}
}
}
break;