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

WindowServer: Add the screen mode property in the screen configuration

This will allow us to change between a couple of properties, for now
it's only Device and Virtual. (How about Remote :^) ) These get handled
by a different screen backend in the Screen.
This commit is contained in:
kleines Filmröllchen 2022-03-31 18:49:26 +02:00 committed by Linus Groh
parent e95ae4a143
commit be98ce0f9f
6 changed files with 72 additions and 22 deletions

View file

@ -18,7 +18,12 @@ namespace WindowServer {
class ScreenLayout {
public:
struct Screen {
String device;
enum class Mode {
Invalid,
Device,
Virtual,
} mode;
Optional<String> device;
Gfx::IntPoint location;
Gfx::IntSize resolution;
int scale_factor;
@ -28,6 +33,22 @@ public:
return { location, { resolution.width() / scale_factor, resolution.height() / scale_factor } };
}
static StringView mode_to_string(Mode mode)
{
#define __ENUMERATE_MODE_ENUM(val) \
case Mode::val: \
return #val;
switch (mode) {
__ENUMERATE_MODE_ENUM(Invalid)
__ENUMERATE_MODE_ENUM(Device)
__ENUMERATE_MODE_ENUM(Virtual)
}
VERIFY_NOT_REACHED();
#undef __ENUMERATE_MODE_ENUM
}
bool operator==(Screen const&) const = default;
};