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
Update to glutin 0.17 #3
Conversation
It doesn't compile without warnings, because of changes in the virtual keycodes.
|
I'm having some trouble getting the right viewport sizes in the examples of |
Works fine on linux. Looks good to me |
The examples in If you are using a screen with a higher DPI factor you should notice that native windows and GUI text are now scaled properly. Do we want this last behavior to also be controllable with a bool in |
@jice-nospam Does the DPI scaling not affect the visual quality of native graphics in |
@IvoWingelaar I don't see any difference but I'm using a Linux VM. I'll double check on native Windows asap (also potential performance impact) |
everything's ok on windows, and no impact on perfs. |
@edwin0cheng shall we merge ? |
Sure And anything else looks good to me. |
The current code should work correctly, and can be merged. Properly implementing DPI scaling (and making it configurable) is kinda tricky, as explained here. Currently I simply scale all Proper DPI support would require exposing only |
Priceless ! As a 3D game engine, I don't think unrust should expose this to users. The game engine should use 3D (opengl) coordinates in the range -1...1 and your image scales to fill the game window (which in most cases should cover the whole screen). Your UI should do the same and thus, be HiDPI insensitive (and even screen-resolution insensitive). |
@jice-nospam That works in 95% of the cases, but I've previously had some bad experiences with software not being aware of HiDPI and drawing UI elements way too small (like, unreadable). So I kinda agree with glutin's docs here. When drawing stuff that needs to be pixel perfect (like That's why I brought up the flag to disable this behavior, as there are legitimate use cases for it to be optional. Disabling this behavior is not possible in But as @edwin0cheng has actually written code that tries to take DPI into consideration for the UI in
This should cover almost everything, I believe. When first reading the docs of If given the green light, I can try and implement this. |
I suggest we merge this glutin-0.17 upgrade as-is (just add a flag to AppConfig to disable hidpi scaling), then create another PR for adding hidpi factor in the API. |
@IvoWingelaar, @jice-nospam Indeed, I would prefer to discuss all these changes in issue page first and make it easy to track. On the other hand, Here is my two cents about DPI related issues:
I think it is okay in general, but how to handle multiple-monitor situation ? Of course currently unrust did not handle it, but for Native values we do not require to handle it (except UI). Or, How about we embed the DPI information in all these Logical values (e.g. a tuple / struct (x,y, w,h,dpi), or an enum which provide the information and conversion ) ?
This one is a little bit tricky. I would recommend us to provide a logical to native conversion utility, or as above mentioned, use an Enum to represent all DPI related information. |
It doesn't compile without warnings, because of changes in the virtual
keycodes.
LMenu
maps to"AltLeft"
insrc/native_keycode.rs
, but this isn't defined byglutin 0.17
. I assume the fix is simply mappingLAlt
to"AltLeft"
(ditto forRMenu
) and adding the three missing patternsCopy
,Cut
, andPaste
?I would have already done this, but we currently map
LAlt
to""
, so I'm quite confused as to the purpose ofLMenu
andLAlt
.