1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 20:47:45 +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

@ -98,7 +98,7 @@ bool Screen::apply_layout(ScreenLayout&& screen_layout, String& error_msg)
for (auto& it : screens_with_resolution_change) {
auto& existing_screen = *it.key;
dbgln("Closing device {} in preparation for resolution change", layout_backup.screens[existing_screen.index()].device);
dbgln("Closing device {} in preparation for resolution change", layout_backup.screens[existing_screen.index()].device.value_or("<virtual screen>"));
existing_screen.close_device();
}
@ -229,15 +229,20 @@ bool Screen::open_device()
auto& info = screen_layout_info();
// TODO: Support other backends
m_backend = make<HardwareScreenBackend>(info.device);
auto return_value = m_backend->open();
if (return_value.is_error()) {
dbgln("Screen #{}: Failed to open backend: {}", index(), return_value.error());
return false;
if (info.mode == ScreenLayout::Screen::Mode::Device) {
m_backend = make<HardwareScreenBackend>(info.device.value());
auto return_value = m_backend->open();
if (return_value.is_error()) {
dbgln("Screen #{}: Failed to open backend: {}", index(), return_value.error());
return false;
}
set_resolution(true);
return true;
}
set_resolution(true);
return true;
dbgln("Unsupported screen type {}", ScreenLayout::Screen::mode_to_string(info.mode));
return false;
}
void Screen::close_device()