mirror of
https://github.com/RGBCube/serenity
synced 2025-05-25 19:15:06 +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:
parent
8dbd1cb9fb
commit
151f32b827
8 changed files with 46 additions and 21 deletions
|
@ -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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue