Comments (12)
Hey @190n, good news! I was able to get a Fedora+Wayland working on my machine and did some test (this is good because I can test anything there from now on). And the issue is fixed using the latest changes in winit. The bad news is that winit's version isn't published yet. Once published we need to wait (or help) with glutin getting updated too.
So this will be a fix for notan 0.10.0
which is almost done, however, blocked
now for this. Once a new version of winit and glutin gets published I'll update notan and probably release 0.10
.
Thanks for reporting this, all the testing, and your patience.
from notan.
Hey! Unfortunately I don't have access to wayland, and this seems not be an issue using Xorg. My guess is that something can be wrong with winit and wayland. Both ways to set the size use the same way to do it, the difference is that WindowConfig is doing it before the creation of the window and set_size is doing it after. Can you share what graphics card are you using? just to know if it's nvidia. And what screen dpi?
Let's see if we figure it a solution. Meanwhile I am marking this as need help
for now to see if somebody with wayland can help us.
from notan.
I am thinking another thing, can you set .resizable(true)
on WindowConfig
and see after you resize the window manually the surface get right the size?
from notan.
Can you try with this branch? https://github.com/Nazariglez/notan/tree/log/size and paste here all the logs? Thanks
from notan.
Thank you for the quick replies!
-
I'm using Intel Alder Lake integrated graphics (i5-1240P). Linux 6.2.12, mesa 23.0.3-1. Screen scaling is 125%, but GNOME is weird about that so I think it actually reports 200% scale and the wrong screen resolution to applications and then scales them down to look right. I also tried changing the scale factor to 100%, and all symptoms are the same.
-
With
.resizeable(true)
, the initial size is 420x420 instead of 420x455.gfx.size()
does seem to accurately report the size -- when I shrink the window until it prints 400x400 in the terminal, the white rectangle covers the whole area. -
Here's the output from the version including resizeable:
1: config: WindowConfig { title: "Notan App", width: 400, height: 400, fullscreen: false, min_size: None, max_size: None, maximized: false, resizable: true, vsync: false, multisampling: 0, high_dpi: false, lazy_loop: false, transparent: false, always_on_top: false, decorations: true, visible: true, mouse_passthrough: false, canvas_id: "notan_canvas", window_icon_path: None, window_icon_data: None, taskbar_icon_path: None, taskbar_icon_data: None } 2023-05-06 00:21:37 [crossfont::ft] DEBUG: Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 } 2: backend::size: (400, 400) 2023-05-06 00:21:37 [notan_glow] INFO: Using opengl graphics api 3: app::size: (400, 400) 4: graphics::size: (400, 400) - graphics::dpi: 1.0 5: app::size: (400, 400) - graphics::size: (400, 400) - graphics::dpi: 1.0 420 x 420 420 x 420 420 x 420
At this point my code starts printing 420x420 a lot. Here is the output from the non-resizeable version:
1: config: WindowConfig { title: "Notan App", width: 400, height: 400, fullscreen: false, min_size: None, max_size: None, maximized: false, resizable: false, vsync: false, multisampling: 0, high_dpi: false, lazy_loop: false, transparent: false, always_on_top: false, decorations: true, visible: true, mouse_passthrough: false, canvas_id: "notan_canvas", window_icon_path: None, window_icon_data: None, taskbar_icon_path: None, taskbar_icon_data: None } 2023-05-06 00:22:32 [crossfont::ft] DEBUG: Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 } 2: backend::size: (400, 400) 2023-05-06 00:22:32 [notan_glow] INFO: Using opengl graphics api 3: app::size: (400, 400) 4: graphics::size: (400, 400) - graphics::dpi: 1.0 5: app::size: (400, 400) - graphics::size: (400, 400) - graphics::dpi: 1.0 420 x 455 420 x 455 420 x 455
from notan.
I added some more logs to the branch, it's weird that at first everything is set right and then the draw method fails to get right the size. Can you test it again please? You can use cargo run --example window_open
. I put your code there with an app.exit()
on the end of the draw method.
from notan.
Here's the output from that example. The size appears to actually be correct at first:
1: config: WindowConfig { title: "Notan App", width: 400, height: 400, fullscreen: false, min_size: None, max_size: None, maximized: false, resizable: false, vsync: false, multisampling: 0, high_dpi: false, lazy_loop: false, transparent: false, always_on_top: false, decorations: true, visible: true, mouse_passthrough: false, canvas_id: "notan_canvas", window_icon_path: None, window_icon_data: None, taskbar_icon_path: None, taskbar_icon_data: None }
2023-05-07 19:02:56 [crossfont::ft] DEBUG: Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
2: backend::size: (400, 400)
2023-05-07 19:02:56 [notan_glow] INFO: Using opengl graphics api
3: app::size: (400, 400)
4: graphics::size: (400, 400) - graphics::dpi: 1.0
5: app::size: (400, 400) - graphics::size: (400, 400) - graphics::dpi: 1.0
2023-05-07 19:02:56 [notan_winit::backend] INFO: Winit Event: Focused(false)
7: app::size: (400, 400) app:dpi: 1.0 - graphics::size: (400, 400) - graphics::dpi: 1.0
8: app::size: (400, 400) app:dpi: 1.0 - graphics::size: (400, 400) - graphics::dpi: 1.0
400 x 400
If I remove app.exit()
it seems that the size is actually messed up only after the first few frames:
1: config: WindowConfig { title: "Notan App", width: 400, height: 400, fullscreen: false, min_size: None, max_size: None, maximized: false, resizable: false, vsync: false, multisampling: 0, high_dpi: false, lazy_loop: false, transparent: false, always_on_top: false, decorations: true, visible: true, mouse_passthrough: false, canvas_id: "notan_canvas", window_icon_path: None, window_icon_data: None, taskbar_icon_path: None, taskbar_icon_data: None }
2023-05-07 19:03:09 [crossfont::ft] DEBUG: Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
2: backend::size: (400, 400)
2023-05-07 19:03:09 [notan_glow] INFO: Using opengl graphics api
3: app::size: (400, 400)
4: graphics::size: (400, 400) - graphics::dpi: 1.0
5: app::size: (400, 400) - graphics::size: (400, 400) - graphics::dpi: 1.0
2023-05-07 19:03:09 [notan_winit::backend] INFO: Winit Event: Focused(false)
7: app::size: (400, 400) app:dpi: 1.0 - graphics::size: (400, 400) - graphics::dpi: 1.0
8: app::size: (400, 400) app:dpi: 1.0 - graphics::size: (400, 400) - graphics::dpi: 1.0
400 x 400
7: app::size: (400, 400) app:dpi: 1.0 - graphics::size: (400, 400) - graphics::dpi: 1.0
8: app::size: (400, 400) app:dpi: 1.0 - graphics::size: (400, 400) - graphics::dpi: 1.0
400 x 400
7: app::size: (400, 400) app:dpi: 1.0 - graphics::size: (400, 400) - graphics::dpi: 1.0
8: app::size: (400, 400) app:dpi: 1.0 - graphics::size: (400, 400) - graphics::dpi: 1.0
400 x 400
2023-05-07 19:03:09 [notan_winit::backend] INFO: Winit Event: Resized(PhysicalSize { width: 420, height: 455 })
6: app::size: (420, 455) app:dpi: 1.0 - graphics::size: (400, 400) - graphics::dpi: 1.0
7: app::size: (420, 455) app:dpi: 1.0 - graphics::size: (420, 455) - graphics::dpi: 1.0
8: app::size: (420, 455) app:dpi: 1.0 - graphics::size: (420, 455) - graphics::dpi: 1.0
420 x 455
7: app::size: (420, 455) app:dpi: 1.0 - graphics::size: (420, 455) - graphics::dpi: 1.0
8: app::size: (420, 455) app:dpi: 1.0 - graphics::size: (420, 455) - graphics::dpi: 1.0
420 x 455
2023-05-07 19:03:09 [notan_winit::backend] INFO: Winit Event: ScaleFactorChanged { scale_factor: 2.0, new_inner_size: PhysicalSize { width: 840, height: 910 } }
2023-05-07 19:03:09 [notan_winit::backend] INFO: Winit Event: Resized(PhysicalSize { width: 840, height: 910 })
2023-05-07 19:03:09 [notan_winit::backend] INFO: Winit Event: Focused(true)
2023-05-07 19:03:09 [notan_winit::backend] INFO: Winit Event: ModifiersChanged((empty))
7: app::size: (420, 455) app:dpi: 2.0 - graphics::size: (420, 455) - graphics::dpi: 1.0
8: app::size: (420, 455) app:dpi: 2.0 - graphics::size: (420, 455) - graphics::dpi: 2.0
420 x 455
7: app::size: (420, 455) app:dpi: 2.0 - graphics::size: (420, 455) - graphics::dpi: 2.0
8: app::size: (420, 455) app:dpi: 2.0 - graphics::size: (420, 455) - graphics::dpi: 2.0
420 x 455
And then the last three lines are repeated.
from notan.
Hey @190n thanks for the logs, I was able to found (what I think is) the same issue rust-windowing/winit#1446. I'll try to see if there is anything that we can do from notan in the next few days/weeks.
from notan.
As far I can see on the issue in winit, they tell that the size set is a "suggestion" for the OS, and that it's possible that it doesn't respect it, like wayland and swap or similar can do their own thing, so I am not sure if we can do anything more than intestead of hardcode the size to draw the quad get it from app. To be sure, can I ask you for one more test? Just git pull
and win. window_open
until the size changes again please. I would like to see the size reported vs inner vs out and the size that is on gfx vs app.
from notan.
1: config: WindowConfig { title: "Notan App", width: 400, height: 400, fullscreen: false, min_size: None, max_size: None, maximized: false, resizable: false, vsync: false, multisampling: 0, high_dpi: false, lazy_loop: false, transparent: false, always_on_top: false, decorations: true, visible: true, mouse_passthrough: false, canvas_id: "notan_canvas", window_icon_path: None, window_icon_data: None, taskbar_icon_path: None, taskbar_icon_data: None }
2023-05-09 18:13:25 [crossfont::ft] DEBUG: Loaded Face Face { ft_face: Font Face: Regular, load_flags: TARGET_LIGHT, render_mode: "Lcd", lcd_filter: 1 }
Winit inner_size PhysicalSize { width: 400, height: 400 }, scale: 1, logical LogicalSize { width: 400.0, height: 400.0 } inner_scale 1.0
2: backend::size: (400, 400)
2023-05-09 18:13:25 [notan_glow] INFO: Using opengl graphics api
Winit inner_size PhysicalSize { width: 400, height: 400 }, scale: 1, logical LogicalSize { width: 400.0, height: 400.0 } inner_scale 1.0
3: app::size: (400, 400)
Winit inner_size PhysicalSize { width: 400, height: 400 }, scale: 1, logical LogicalSize { width: 400.0, height: 400.0 } inner_scale 1.0
4: graphics::size: (400, 400) - graphics::dpi: 1.0
Winit inner_size PhysicalSize { width: 400, height: 400 }, scale: 1, logical LogicalSize { width: 400.0, height: 400.0 } inner_scale 1.0
5: app::size: (400, 400) - graphics::size: (400, 400) - graphics::dpi: 1.0
2023-05-09 18:13:25 [notan_winit::backend] INFO: Winit Event: Focused(false)
Winit inner_size PhysicalSize { width: 400, height: 400 }, scale: 1, logical LogicalSize { width: 400.0, height: 400.0 } inner_scale 1.0
7: app::size: (400, 400) app:dpi: 1.0 - graphics::size: (400, 400) - graphics::dpi: 1.0
8: app::size: (400, 400) app:dpi: 1.0 - graphics::size: (400, 400) - graphics::dpi: 1.0
Winit inner_size PhysicalSize { width: 400, height: 400 }, scale: 1, logical LogicalSize { width: 400.0, height: 400.0 } inner_scale 1.0
gfx: (400, 400), app: (400, 400)
Winit inner_size PhysicalSize { width: 400, height: 400 }, scale: 1, logical LogicalSize { width: 400.0, height: 400.0 } inner_scale 1.0
7: app::size: (400, 400) app:dpi: 1.0 - graphics::size: (400, 400) - graphics::dpi: 1.0
8: app::size: (400, 400) app:dpi: 1.0 - graphics::size: (400, 400) - graphics::dpi: 1.0
Winit inner_size PhysicalSize { width: 400, height: 400 }, scale: 1, logical LogicalSize { width: 400.0, height: 400.0 } inner_scale 1.0
gfx: (400, 400), app: (400, 400)
Winit inner_size PhysicalSize { width: 400, height: 400 }, scale: 1, logical LogicalSize { width: 400.0, height: 400.0 } inner_scale 1.0
7: app::size: (400, 400) app:dpi: 1.0 - graphics::size: (400, 400) - graphics::dpi: 1.0
8: app::size: (400, 400) app:dpi: 1.0 - graphics::size: (400, 400) - graphics::dpi: 1.0
Winit inner_size PhysicalSize { width: 400, height: 400 }, scale: 1, logical LogicalSize { width: 400.0, height: 400.0 } inner_scale 1.0
gfx: (400, 400), app: (400, 400)
2023-05-09 18:13:25 [notan_winit::backend] INFO: Winit Event: Resized(PhysicalSize { width: 420, height: 455 })
> Resized: evt:PhysicalSize { width: 420, height: 455 } in:PhysicalSize { width: 420, height: 455 } out:PhysicalSize { width: 420, height: 455 }, dpi:1
Winit inner_size PhysicalSize { width: 420, height: 455 }, scale: 1, logical LogicalSize { width: 420.0, height: 455.0 } inner_scale 1.0
6: app::size: (420, 455) app:dpi: 1.0 - graphics::size: (400, 400) - graphics::dpi: 1.0
7: app::size: (420, 455) app:dpi: 1.0 - graphics::size: (420, 455) - graphics::dpi: 1.0
8: app::size: (420, 455) app:dpi: 1.0 - graphics::size: (420, 455) - graphics::dpi: 1.0
Winit inner_size PhysicalSize { width: 420, height: 455 }, scale: 1, logical LogicalSize { width: 420.0, height: 455.0 } inner_scale 1.0
gfx: (420, 455), app: (420, 455)
Winit inner_size PhysicalSize { width: 420, height: 455 }, scale: 1, logical LogicalSize { width: 420.0, height: 455.0 } inner_scale 1.0
7: app::size: (420, 455) app:dpi: 1.0 - graphics::size: (420, 455) - graphics::dpi: 1.0
8: app::size: (420, 455) app:dpi: 1.0 - graphics::size: (420, 455) - graphics::dpi: 1.0
Winit inner_size PhysicalSize { width: 420, height: 455 }, scale: 1, logical LogicalSize { width: 420.0, height: 455.0 } inner_scale 1.0
gfx: (420, 455), app: (420, 455)
2023-05-09 18:13:25 [notan_winit::backend] INFO: Winit Event: ScaleFactorChanged { scale_factor: 2.0, new_inner_size: PhysicalSize { width: 840, height: 910 } }
2023-05-09 18:13:25 [notan_winit::backend] INFO: Winit Event: Resized(PhysicalSize { width: 840, height: 910 })
> Resized: evt:PhysicalSize { width: 840, height: 910 } in:PhysicalSize { width: 840, height: 910 } out:PhysicalSize { width: 840, height: 910 }, dpi:2
2023-05-09 18:13:25 [notan_winit::backend] INFO: Winit Event: Focused(true)
2023-05-09 18:13:25 [notan_winit::backend] INFO: Winit Event: ModifiersChanged((empty))
Winit inner_size PhysicalSize { width: 840, height: 910 }, scale: 2, logical LogicalSize { width: 420.0, height: 455.0 } inner_scale 2.0
7: app::size: (420, 455) app:dpi: 2.0 - graphics::size: (420, 455) - graphics::dpi: 1.0
8: app::size: (420, 455) app:dpi: 2.0 - graphics::size: (420, 455) - graphics::dpi: 2.0
Winit inner_size PhysicalSize { width: 840, height: 910 }, scale: 2, logical LogicalSize { width: 420.0, height: 455.0 } inner_scale 2.0
gfx: (420, 455), app: (420, 455)
Winit inner_size PhysicalSize { width: 840, height: 910 }, scale: 2, logical LogicalSize { width: 420.0, height: 455.0 } inner_scale 2.0
7: app::size: (420, 455) app:dpi: 2.0 - graphics::size: (420, 455) - graphics::dpi: 2.0
8: app::size: (420, 455) app:dpi: 2.0 - graphics::size: (420, 455) - graphics::dpi: 2.0
Winit inner_size PhysicalSize { width: 840, height: 910 }, scale: 2, logical LogicalSize { width: 420.0, height: 455.0 } inner_scale 2.0
gfx: (420, 455), app: (420, 455)
Winit inner_size PhysicalSize { width: 840, height: 910 }, scale: 2, logical LogicalSize { width: 420.0, height: 455.0 } inner_scale 2.0
7: app::size: (420, 455) app:dpi: 2.0 - graphics::size: (420, 455) - graphics::dpi: 2.0
8: app::size: (420, 455) app:dpi: 2.0 - graphics::size: (420, 455) - graphics::dpi: 2.0
Winit inner_size PhysicalSize { width: 840, height: 910 }, scale: 2, logical LogicalSize { width: 420.0, height: 455.0 } inner_scale 2.0
gfx: (420, 455), app: (420, 455)
Winit inner_size PhysicalSize { width: 840, height: 910 }, scale: 2, logical LogicalSize { width: 420.0, height: 455.0 } inner_scale 2.0
7: app::size: (420, 455) app:dpi: 2.0 - graphics::size: (420, 455) - graphics::dpi: 2.0
8: app::size: (420, 455) app:dpi: 2.0 - graphics::size: (420, 455) - graphics::dpi: 2.0
Winit inner_size PhysicalSize { width: 840, height: 910 }, scale: 2, logical LogicalSize { width: 420.0, height: 455.0 } inner_scale 2.0
gfx: (420, 455), app: (420, 455)
All the same after this.
from notan.
The 3 sizes reported by winit are the same, I am not sure right now if this is intended or it's a bug, I am opening an issue on winit rust-windowing/winit#2799
from notan.
This issue is stale because it has been open for 1 year with no activity.
from notan.
Related Issues (20)
- Clipboard not working on Linux x11 (i3wm) HOT 1
- Multisampling setting seems to be ignored HOT 2
- notan_draw docs won't build since 0.8.0 HOT 2
- `notan_graphics` depends on `image` when feature `texture_to_file` is disabled HOT 1
- Colors on 0.10.0 are much darker than on 0.9.5 HOT 8
- Egui blurry (Possibly mutlisampling being applied over the egui render)
- Let's talk about the future of Notan - Looking for maintainers HOT 3
- Please remove the dependency on the crate glsl-to-spirv because it is unmaintained and abandoned HOT 3
- Error: "extension to create ES context with wgl is not present" HOT 6
- Update egui to 0.23.0
- readme images hosted in gfycat.com no longer exist HOT 3
- Tests that make a notan instance fail, winit "Initializing the event loop outside of the main thread is a significant cross-platform compatibility hazard" HOT 4
- The deprecated crate glsl-to-spirv-1.7.0 is used, and it fails to compile HOT 1
- lazy_loop does not update with `request_frame()` on Windows HOT 3
- Possibility to set app_id HOT 5
- Scale issue with decimal scale factors on X11
- Blurry text / low-dpi egui since v0.12.0 HOT 2
- Can't compile notan_macro in Windows HOT 1
- Window bash scripts (powershell) HOT 5
- Audio latency HOT 5
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 notan.