rust-windowing / winit

Window handling library in pure Rust
https://docs.rs/winit/
Apache License 2.0
4.84k stars 902 forks source link

winit 0.10.1/x11 render issue - top & right cut off #398

Closed alexheretic closed 6 years ago

alexheretic commented 6 years ago

Today my projects are missing a small part of the top & right sections after updating to winit 0.10.1. This appears to only affect x11 (I tested in windows which was fine).

My projects are all affected using gfx/glutin, but this can also be reproduced by using glium cargo update; cargo run --example image

winit 0.10.1 (cut off top & right)

glium-winit-0 10 1

winit =0.10.0 (expected)

glium-winit-0 10 0

tomaka commented 6 years ago

Probably an HiDPI issue.

alexheretic commented 6 years ago

I've narrowed down the regression to being introduced with 150d2706f9b564e7961b0c30bd7b7e4dd6c37253 (#386).

My hidpi_factor is 1 before & after, so I don't think that is an issue.

alexheretic commented 6 years ago

This issue is present all x11 DE/WMs on my setup. It's least pronounced in i3, but there is still a difference (mostly the right cut off).

Gnome

gnome-winit

KDE Plasma

kde-plasma-winit

Xfce

xfce-winit

Mate

mate-winit

Budgie

budgie-winit

i3

i3-winit Note: I sized i3 manually

b-r-u commented 6 years ago

i3

Increasing the border width makes this issue really noticeable. (Add new_window pixel 20 in .i3/config) This is a floating window with a 20px blue border:

glium_i3_border_20px

alexheretic commented 6 years ago

I've just tested this on separate hardware too, running Ubuntu 16.04 screenshot from 2018-02-07 14-27-38

I think this + @b-r-u's example shows this does indeed affect all x11 setups. We should probably revert 150d2706f9b564e7961b0c30bd7b7e4dd6c37253. Are you able to produce this @jwilm?

I wonder if we can automate a regression test for this - an image comparison under xvfb perhaps? It'd be nice to have a headless test for all backends ideally.

jwilm commented 6 years ago

@alexheretic The bug doesn't really show up on my machine because I only have 2 px borders, but there's no doubt it was introduced there. Rather than revert that commit, it would be reasonable to update that code to get the dimensions from the Window winit references and still return positioning data based on the most-parent window.

jwilm commented 6 years ago

@alexheretic does #402 resolve this for you?

alexheretic commented 6 years ago

@jwilm fair enough, yep I just checked it. Thanks for fixing this!

b-r-u commented 6 years ago

This commit works for me, too.

alexheretic commented 6 years ago

@tomaka We should merge #402 and release before closing this don't you think?

tomaka commented 6 years ago

Whoops! Merging the PR is now done, closing the issue is ok even when not released.