-
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
with_always_on_top
causes window to display incorrectly when window size is equal to screen size
#4458
Comments
This situation should indeed be related to whether it is focused or not. When I use with_active(false), the window is initially normal. When I use the mouse to click on the window so that it has focus, the strange full-screen window appears again. |
Please provide a complete example without any omissions. |
to reproduce fn main() {
use eframe::epaint::Color32;
use egui::{Frame, Key, ViewportBuilder, ViewportCommand};
let option = eframe::NativeOptions {
viewport: ViewportBuilder::default()
.with_taskbar(false)
.with_decorations(false)
// .with_always_on_top() // <= uncomment this line to reproduce the bug
.with_position([10.0, 10.0])
// replace with the screen size for the actual use
.with_inner_size([1920.0, 1080.0]),
..Default::default()
};
eframe::run_simple_native(
"my-app",
option,
|ctx, _frame| {
egui::CentralPanel::default()
.frame(Frame::none().fill(Color32::WHITE))
.show(ctx, |ui| {
if ui.button("close").clicked() {
ctx.send_viewport_cmd(ViewportCommand::Close);
}
if ctx.input(|i| i.key_pressed(Key::Escape)) {
ctx.send_viewport_cmd(ViewportCommand::Close);
}
});
},
).unwrap();
} This only occurs when the window size is equal(or larger) to the screen size, so changing the window size defeats my purpose. And transparency does not matter here. |
I didn't find any abnormalities with the above example in Windows 10. If there is no if ui.button("Maximized").clicked() {
ui.ctx()
.send_viewport_cmd(egui::ViewportCommand::Maximized(true));
}
if ui.button("innersize").clicked() {
ui.ctx()
.send_viewport_cmd(egui::ViewportCommand::InnerSize(egui::Vec2::new(500.0, 500.0)));
} |
After uncommenting the with_always_on_top line and setting the window size to the screen size (it can also be set to a large value, such as 9999), is there the set 10 pixels of space on the left and top of the window that appears?
I asked my friend to test it, and it also happened on win11. |
I have two screens and each is enlarged, so I didn't adjust the window size to fit the screen size. If you reduce the window size, check if there are any problems. |
When the window size is smaller than the screen size, there are no problems and everything works as expected. The problem I described should be visible in the case of a single monitor. I only have one monitor at home. I need to go to the company tomorrow to see the multi-monitor situation. |
Try removing Use ViewportCommand temporarily. |
This may be a problem that occurs when using Check if there is no problem if you do not use one of |
This bug will appear whether When
3EEA64F30FE8CAD689559B650E906E6F.mp4 |
Thank you so much! I used #4467 for testing and the issue discussed here no longer occurs. But it seems like flickering is newly introduced. The moment the application is started, part of the window is white first, and then all of it is white. like this 👇 |
When I create a window with a size equal to the screen and use always_on_top, the window displays incorrectly and transparency becomes invalid
I tried using screen recording software, but I couldn’t see this in the recorded video, so I used my mobile phone to shoot. Please bear with me.
First time, I didn't use
with_always_on_top
, the window was created normally (size 1920*1080, position 10, 10).The second time, I used with_always_on_top, and I could see that a black window appeared covering the full screen (actually its upper left corner should be (10,10)). When I clicked outside the window, the window became Displayed normally. (This situation seems to be that when the window has focus, it will display abnormally, and when it is out of focus, it will display normally.)
I don’t know if this is a problem with the implementation of always_on_top on Windows.
5F491E0DFA7C77E7C659953D7B1FBDD6.mp4
The versions of egui and eframe are both 0.27.2
my option and updateFn of app:
The text was updated successfully, but these errors were encountered: