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
commit 151f32b827
Notes: sideshowbarker 2024-07-19 08:59:38 +09:00
8 changed files with 46 additions and 21 deletions

View file

@ -68,12 +68,23 @@ Screen::~Screen()
{
}
void Screen::set_resolution(int width, int height)
bool Screen::set_resolution(int width, int height)
{
FBResolution resolution { 0, (int)width, (int)height };
int rc = fb_set_resolution(m_framebuffer_fd, &resolution);
ASSERT(rc == 0);
on_change_resolution(resolution.pitch, resolution.width, resolution.height);
#ifdef WSSCREEN_DEBUG
dbg() << "fb_set_resolution() - return code " << rc;
#endif
if (rc == 0) {
on_change_resolution(resolution.pitch, resolution.width, resolution.height);
return true;
}
if (rc == -1) {
dbg() << "Invalid resolution " << width << "x" << height;
on_change_resolution(resolution.pitch, resolution.width, resolution.height);
return false;
}
ASSERT_NOT_REACHED();
}
void Screen::on_change_resolution(int pitch, int width, int height)