-
Notifications
You must be signed in to change notification settings - Fork 1.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Infinite negative dimensions on window #4135
Comments
Internal information must be used using use eframe::{egui::ViewportBuilder, NativeOptions};
fn main() {
eframe::run_simple_native(
"is this dark matter?",
NativeOptions {
viewport: ViewportBuilder::default()
.with_min_inner_size([1000.0, 1000.0]),
..Default::default()
},
|ctx, _| {
dbg!(ctx.used_size(), ctx.used_rect());
let monitor_size = ctx.input(|i| i.viewport().monitor_size);
let inner_rect = ctx.input(|i| i.viewport().inner_rect);
let outer_rect = ctx.input(|i| i.viewport().outer_rect);
println!("{:?}", monitor_size);
println!("{:?}", inner_rect);
println!("{:?}", outer_rect);
},
)
.expect("wait that wasn't supposed to be what went wrong...");
} |
Thanks for the tip! I updated the print statements you gave to identify which value was being printed to make sure I could differentiate them, and I got this as the first set of results (with the print statements repeating the last three values afterwards):
I imagine that the |
That works fine on windows. use eframe::{egui::ViewportBuilder, NativeOptions};
fn main() {
eframe::run_simple_native(
"is this dark matter?",
NativeOptions {
viewport: ViewportBuilder::default().with_min_inner_size([1000.0, 1000.0]),
..Default::default()
},
|ctx, _| {
egui::CentralPanel::default().show(ctx, |ui| {
let monitor_size = ui.ctx().input(|i| i.viewport().monitor_size);
let inner_rect = ui.ctx().input(|i| i.viewport().inner_rect);
let outer_rect = ui.ctx().input(|i| i.viewport().outer_rect);
println!("{:?}", monitor_size);
println!("{:?}", inner_rect);
println!("{:?}", outer_rect);
});
},
)
.expect("wait that wasn't supposed to be what went wrong...");
} |
Hmm, this has the same issue, but weirdly it reports slightly different dimensions for the monitor as a whole:
|
There is no problem on Windows, so I think someone using Linux will have to solve it. |
Yeah, I suspect this might even be more specific than just Linux in general. I'm having this issue on the Plasma 6 desktop environment that just came out last week, so I wouldn't be surprised if this is specific to that DE. |
Can you apply the following to check if there are any problems and let me know the results? Pull Requests #4182 |
Thanks for the suggestion! Running off that branch seems like it might have fixed the issue; the window starts up with a size lower than the minimum I set, but then as soon as I try to adjust it, the size immediately becomes the minimum I set and then won't allow resizing lower. I imagine that I should be able to just set the initial size manually to the same as the minimum to avoid needing to do that initial adjustment. |
It seems to be the same problem as below. Related content : |
Could you try applying the information below one more time and let me know the results? Pull Request : |
The windows created by
eframe
on my system seem to not be able to detect their dimensions, which I noticed due toViewportBuilder::with_min_inner_size
not doing anything. (To potentially save time for people reading this, I suspect this is due to my somewhat bleeding-edge desktop environment, which I included details about below in the relevant section).To Reproduce
Steps to reproduce the behavior:
cargo run
orcargo run --release
Check that the window is rendered properly
Check the print output and see the following:
Expected behavior
The dimensions reported by
Context::used_rect
andContext::used_size
would be accurate (presumably positive, given that the window does seem to render fine) and the minimum size specified would be respected.Screenshots
Desktop:
I suspect this might be where the issues lies; I'm using Plasma 6 from the Arch Linux testing repos, which only became available this week.
uname
shown below)wayland-info
for details)wayland_info.txt
I'm unfortunately not sure what the best way to determine which rendering output is being used by eframe. I'm fairly certain that it's not using X11 because I generally can identify windows using XWayland by using
wmctrl
because it doesn't ever list info about native Wayland windows, and it similarly doesn't have any output related to the window opened byeframe
. I'm not sure if it's using thewayland
backend orglow
(or if those are entirely different things rather than mutually exclusive options; I'm pretty inexperienced in programming GUIs).Assuming this isn't reproducible easily on other desktops, I'm happy to add any additional info (either from my system or updating the repro code to print something else) that would be helpful to try to narrow cause what's causing this! If there's a different destkop environment that would be helpful for me to check, it shouldn't be too much of an issue; reverting back to Plasma 5 to test this would unfortunately be a bit of a pain given that I plan to keep using 6, but if there's no other way to sanity check things, I might be able to find an old laptop or something to boot up and try it out on that.
The text was updated successfully, but these errors were encountered: