Comments (12)
struct MainWindow;
impl MainWindow {
fn create(_cc: &eframe::CreationContext<'_>) -> Self {
Self
}
}
impl eframe::App for MainWindow {
fn update(&mut self, ctx: &eframe::egui::Context, _frame: &mut eframe::Frame) {
eframe::egui::CentralPanel::default().show(ctx, |_ui| {
// empty app
});
}
}
fn main() -> eframe::Result<()> {
let options = eframe::NativeOptions::default();
eframe::run_native("vscode", options, Box::new(|cc| Box::new(MainWindow::create(cc))))
}
using eframe v0.26.2
from egui.
I copied the code and ran it on my machine, and I still had the same problem with both viewports. It might be an issue with Windows 11 or just my machine.
from egui.
@rustbasic
still the same issue
from egui.
Have you tried the wgpu
backend?
from egui.
How would I use it natively?
from egui.
Just enable the wgpu
feature of eframe
from egui.
Thank you!
Adding the wgpu
feature does prevent the crashing, but it does also make the viewport look slightly stretched while I resize it, as well as doubling the file size of the output binary. Both of these I don't really like.
Not much of an issue though, and I can use it for now, but I would prefer if the default backend worked properly (no crashing when resizing from a corner)
from egui.
@OSCH2008
If you could make a simple example with one file (panic occurs when resizing), it would be helpful to check.
from egui.
I tried running the hello_world example on Windows 11 with the default features, and it didn't crash when resizing. Have you tried that? You have another dependency called screen-info that has a lot of unsafe code. Does it crash without that dependency as well? If you're only using it to center the window on the screen at startup, you can do that by passing centered: true
to NativeOptions
.
from egui.
I did use screen-info
to calculate the center of my screen for the window, because I didn't like the inaccuracy of centered = true
in one of my previous projects. But removing that dependency and using centered = true
instead still did not stop the crashes.
from egui.
@OSCH2008
With the above source code, I tested it with egui v0.26.2 on Windows 10.
There is nothing wrong. ( I'm not used wgpu. )
I added one Viewport as follows and tested it all, and there was no problem.
struct MainWindow;
impl MainWindow {
fn create(_cc: &eframe::CreationContext<'_>) -> Self {
Self
}
}
impl eframe::App for MainWindow {
fn update(&mut self, ctx: &eframe::egui::Context, _frame: &mut eframe::Frame) {
eframe::egui::CentralPanel::default().show(ctx, |ui| {
ui.label("Main : Corner resize TEST");
dev_viewport_immediate(ui);
});
}
}
fn main() -> eframe::Result<()> {
let options = eframe::NativeOptions::default();
eframe::run_native("vscode", options, Box::new(|cc| {
Box::new(MainWindow::create(cc))
}))
}
pub fn dev_viewport_immediate(ui: &mut egui::Ui) {
let title = "Immediate Viewport";
ui.ctx().show_viewport_immediate(
egui::ViewportId::from_hash_of(title),
egui::ViewportBuilder::default()
.with_title(title)
.with_inner_size([800.0, 600.0]),
|ctx, class| {
assert!(
class == egui::ViewportClass::Immediate,
"This egui backend doesn't support multiple viewports"
);
egui::CentralPanel::default().show(ctx, |ui| {
ui.label("Viewport : Corner resize TEST");
});
if ctx.input(|i| i.viewport().close_requested()) {
// Tell parent viewport that we should not show next frame:
}
},
);
}
from egui.
I copied the code and ran it on my machine, and I still had the same problem with both viewports. It might be an issue with Windows 11 or just my machine.
cargo update
After trying once, try compiling again.
from egui.
Related Issues (20)
- Update `rustls` to remove RUSTSEC warning HOT 1
- SidePanel resizing behaves strange(?) when going out of bounds
- (Web demo) Cursor icon animation lags when cursor not moving
- Introduce a new Operation<T> enum for widgets with from_get_set HOT 2
- When making a Pull Request, it takes too much time to 12 `cargo-deny` items. HOT 1
- Context menu on the TextEdit widget
- egui access_kit API docs HOT 1
- Close Window or Frame HOT 2
- Smooth scrolling introduced latency
- Android WASM google keyboard backspace not working with suggestions
- web_demo: Table: Does not fill entire height
- Firefox panic with parking_lot (Parking not supported on this platform) HOT 5
- Scrollbars and other draggable elements get stuck mouse leaves browser window HOT 2
- [Web Rendering Bug]: Unexpected Height Event Setter Behavior on Mouse Move when Integrating Yew with Egui HOT 4
- After the #4337 update, the 'egui_demo_app' screen does not appear.
- eframe demo panic on startup
- Feature to get target refresh rate HOT 4
- Not detecting mouse release after alt-tab on windows
- egui_glow's winit feature should be enabled on wasm
- Context Menus demo crashes on negative width or height HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from egui.