PistonDevelopers/glutin_window

Coordinate system is messed up in 0.45.2

0e4ef622 opened this issue · 6 comments

A square drawn at (0, 400) appears differently in 0.45.1 and 0.45.2.

0.45.1:
0.45.1

0.45.2:
0.45.2

https://gist.github.com/0e4ef622/085fcd4e0cb1b51e431b113b48474723

However, it seems that when you define the y coordinate relative to the bottom of the window (height - y) it is drawn correctly. The converse is true when using the x-coordinate (works normally, but width - x doesn't).

This only seems to occur on HiDPI displays, which would make sense since the only changes between 0.45.1 and 0.45.2 have to do with HiDPI scaling.

Which OS are you on?

Arch Linux 4.15.7

There is a bug in winit/glutin which appears on OSX retina screens. I added a bug detection to fix it (it works on OSX now) but it seems this does not work properly on Arch Linux. Can you take a look at the code https://github.com/PistonDevelopers/glutin_window/blob/master/src/lib.rs#L140 and see what happens to the inner size when you initialize the window?

Ok I figured it out, it's because I am using a tiling window manager (i3-wm), so when the window is created, the requested size is ignored and the window's size is set to whatever will fit the layout of the screen. Since the requested size and the actual size differ, it triggers your bug detecting code and messes it up, because when I set the requested size to the size the window manager wants it to be divided by the HiDPI factor (which in my case, is 1920x1039 ÷ 1.5 = 1280x693), the box is drawn in the correct position.

I've published a new version. Hope this fixes the problem!

Yep, that fixed it. Thanks!