mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 11:08:11 +00:00
WindowServer: Add API to set/get screen layouts
This sets the stage so that DisplaySettings can configure the screen layout and set various screen resolutions in one go. It also allows for an easy "atomic" revert of the previous settings.
This commit is contained in:
parent
34394044b3
commit
aa15bf81e4
23 changed files with 558 additions and 228 deletions
|
@ -297,14 +297,23 @@ Messages::WindowServer::GetWallpaperResponse ClientConnection::get_wallpaper()
|
|||
return Compositor::the().wallpaper_path();
|
||||
}
|
||||
|
||||
Messages::WindowServer::SetResolutionResponse ClientConnection::set_resolution(u32 screen_index, Gfx::IntSize const& resolution, int scale_factor)
|
||||
Messages::WindowServer::SetScreenLayoutResponse ClientConnection::set_screen_layout(ScreenLayout const& screen_layout, bool save)
|
||||
{
|
||||
if (auto* screen = Screen::find_by_index(screen_index)) {
|
||||
bool success = WindowManager::the().set_resolution(*screen, resolution.width(), resolution.height(), scale_factor);
|
||||
return { success, screen->size(), screen->scale_factor() };
|
||||
}
|
||||
dbgln("Setting resolution: Invalid screen index {}", screen_index);
|
||||
return { false, {}, 0 };
|
||||
String error_msg;
|
||||
bool success = WindowManager::the().set_screen_layout(ScreenLayout(screen_layout), save, error_msg);
|
||||
return { success, move(error_msg) };
|
||||
}
|
||||
|
||||
Messages::WindowServer::GetScreenLayoutResponse ClientConnection::get_screen_layout()
|
||||
{
|
||||
return { WindowManager::the().get_screen_layout() };
|
||||
}
|
||||
|
||||
Messages::WindowServer::SaveScreenLayoutResponse ClientConnection::save_screen_layout()
|
||||
{
|
||||
String error_msg;
|
||||
bool success = WindowManager::the().save_screen_layout(error_msg);
|
||||
return { success, move(error_msg) };
|
||||
}
|
||||
|
||||
void ClientConnection::set_window_title(i32 window_id, String const& title)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue