GithubHelp home page GithubHelp logo

Comments (12)

Nazariglez avatar Nazariglez commented on June 10, 2024 1

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.

Nazariglez avatar Nazariglez commented on June 10, 2024

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.

Nazariglez avatar Nazariglez commented on June 10, 2024

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.

Nazariglez avatar Nazariglez commented on June 10, 2024

Can you try with this branch? https://github.com/Nazariglez/notan/tree/log/size and paste here all the logs? Thanks

from notan.

190n avatar 190n commented on June 10, 2024

Thank you for the quick replies!

  1. 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.

  2. 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.

  3. 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.

Nazariglez avatar Nazariglez commented on June 10, 2024

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.

190n avatar 190n commented on June 10, 2024

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.

Nazariglez avatar Nazariglez commented on June 10, 2024

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.

Nazariglez avatar Nazariglez commented on June 10, 2024

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.

190n avatar 190n commented on June 10, 2024
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.

Nazariglez avatar Nazariglez commented on June 10, 2024

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.

github-actions avatar github-actions commented on June 10, 2024

This issue is stale because it has been open for 1 year with no activity.

from notan.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.