1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 13:28:11 +00:00

WindowServer: Return richer result when changing resolutions

Now we return a boolean value from set_resolution() in the Compositor
and Screen class. Also, the WindowServer IPC now returns a richer result
after changing the resolution, which can be used in clients later.
This commit is contained in:
Liav A 2020-02-27 17:09:41 +02:00 committed by Andreas Kling
parent 8dbd1cb9fb
commit 151f32b827
8 changed files with 46 additions and 21 deletions

View file

@ -397,17 +397,18 @@ void Compositor::run_animations()
});
}
void Compositor::set_resolution(int desired_width, int desired_height)
bool Compositor::set_resolution(int desired_width, int desired_height)
{
auto screen_rect = Screen::the().rect();
if (screen_rect.width() == desired_width && screen_rect.height() == desired_height)
return;
return true;
// Make sure it's impossible to set an invalid resolution
ASSERT(desired_width >= 640 && desired_height >= 480);
Screen::the().set_resolution(desired_width, desired_height);
bool success = Screen::the().set_resolution(desired_width, desired_height);
init_bitmaps();
compose();
return success;
}
Gfx::Rect Compositor::current_cursor_rect() const