1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 16:07:45 +00:00

WindowServer: Create the VirtualScreenBackend

This screen backend is just memory-backed and doesn't connect to any
screen hardware. That way, we can boot Serenity without video hardware
but in full graphical mode :^)

To create a virtual screen, put something like this in your
WindowServer.ini. There's no way yet to do this through Display
Settings, though an existing virtual screen's settings can be changed
there.
```ini
[Screen0]
Mode=Virtual
Left=1024
Top=0
Width=1920
Height=1080
ScaleFactor=1
```
This commit is contained in:
kleines Filmröllchen 2022-04-02 00:30:52 +02:00 committed by Linus Groh
parent be98ce0f9f
commit 935f401714
4 changed files with 140 additions and 4 deletions

View file

@ -10,6 +10,7 @@
#include "Event.h"
#include "EventLoop.h"
#include "ScreenBackend.h"
#include "VirtualScreenBackend.h"
#include "WindowManager.h"
#include <AK/Debug.h>
#include <AK/Format.h>
@ -228,8 +229,8 @@ bool Screen::open_device()
close_device();
auto& info = screen_layout_info();
// TODO: Support other backends
if (info.mode == ScreenLayout::Screen::Mode::Device) {
switch (info.mode) {
case ScreenLayout::Screen::Mode::Device: {
m_backend = make<HardwareScreenBackend>(info.device.value());
auto return_value = m_backend->open();
if (return_value.is_error()) {
@ -240,9 +241,18 @@ bool Screen::open_device()
set_resolution(true);
return true;
}
case ScreenLayout::Screen::Mode::Virtual: {
m_backend = make<VirtualScreenBackend>();
// Virtual device open should never fail.
MUST(m_backend->open());
dbgln("Unsupported screen type {}", ScreenLayout::Screen::mode_to_string(info.mode));
return false;
set_resolution(true);
return true;
}
default:
dbgln("Unsupported screen type {}", ScreenLayout::Screen::mode_to_string(info.mode));
return false;
}
}
void Screen::close_device()