1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 13:27:35 +00:00

DisplaySettings: Add UI for switching the scale factor

For now, only support 1x and 2x scale.

I tried doing something "smarter" first where the UI would try
to keep the physical resolution constant when toggling between
1x and 2x, but many of the smaller 1x resolutions map to 2x
logical resolutions that Compositor rejects (e.g. 1024x768 becomes
512x384, which is less than the minimum 640x480 that Compositor
wants) and it felt complicated and overly magical.

So this instead just gives you a 1x/2x toggle and a dropdown
with logical (!) resolutions. That is, 800x600 @ 2x gives you
a physical resolution of 1600x1200.

If we don't like this after trying it for a while, we can change
the UI then.
This commit is contained in:
Nico Weber 2021-01-15 19:02:17 -05:00 committed by Andreas Kling
parent 05dbfe9ab6
commit f37f281f89
6 changed files with 76 additions and 12 deletions

View file

@ -43,6 +43,9 @@ public:
void set_desktop_resolution(Gfx::IntSize resolution);
Gfx::IntSize desktop_resolution();
void set_desktop_scale_factor(int scale_factor) { m_desktop_scale_factor = scale_factor; }
int desktop_scale_factor() const { return m_desktop_scale_factor; }
void set_background_color(Gfx::Color background_color);
Gfx::Color background_color();
@ -58,6 +61,7 @@ private:
RefPtr<Gfx::Bitmap> m_desktop_wallpaper_bitmap;
String m_desktop_wallpaper_mode;
Gfx::IntSize m_desktop_resolution;
int m_desktop_scale_factor { 1 };
Gfx::Color m_desktop_color;
};