danfragoso / thdwb

🌭 The hotdog web browser and browser engine 🌭
MIT License
1.13k stars 58 forks source link

Hidpi #14

Closed farhaven closed 4 years ago

farhaven commented 4 years ago

Hi!

This PR enables scaling the UI for HiDPI displays. It also includes my previous PR, so if you want to accept it, it should probably be merged after the previous one. The changes are stand-alone though, so I can extract the HiDPI changes if you want.

danfragoso commented 4 years ago

Hi, thanks again for taking the time to fix this. I would like for this PR to only have the changes to scale for HiDPI. I don't have a HiDPI screen to test these changes, so if you can post some prints or record a gif of how it looks like would be nice. Also, can this be a setting? So we can enable and disable scaling by changing the settings.json. { "enableDisplayScaling": true }. Thanks

farhaven commented 4 years ago

I'm busy at work at the moment, I'll create screenshots on the weekend. This is only a very rough "scale everything by 2"-approach though, so I agree that this should be a "set this flag to make the UI usable on HiDPI"-option instead of a "we automatically make the UI beautiful on HiDPI"-thing.

farhaven commented 4 years ago

I've finally had some time to create screenshots and minimize the changes in this branch a bit:

The hiDPI-scaling will only be used in the following conditions:

so for users with low-res screens or users with high-res screens but without scaling, everything looks the same.

I've created a few screenshots to illustrate this. Note that the windows in the first two screenshots have exactly the same physical size on my screen, with the first being almost unreadable since everything is really tiny:

Highres screen, hiDPI mode disabled

highres-hidpi-disabled

Highres screen, hiDPI mode enabled

The UI gets scaled, as does the content. This is very basic scaling done by GLFW, just enough to make THDWB usable on high-res screens. highres-hidpi-enabled

Lowres screen, with hiDPI mode enabled

Note that this looks exactly like it would without this patch, so no change for users with low-res screens.

lowres-hidpi-enabled