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

Applications: Create a display properties manager

An interactive application to modify the current display settings, such as
the current wallpaper as well as the screen resolution. Currently we're
adding the resolutions ourselves, because there's currently no way to
detect was resolutions the current display adapter supports (or at least
I can't see one... Maybe VBE does and I'm stupid). It even comes with
a very nice template'd `ItemList` that can support a vector of any type,
which makes life much simpler.
This commit is contained in:
Jesse Buhagiar 2019-09-03 21:45:02 +10:00 committed by Andreas Kling
parent af14b8dc59
commit ecbc0322c1
15 changed files with 329 additions and 1 deletions

View file

@ -289,6 +289,9 @@ bool WSClientConnection::handle_message(const WSAPI_ClientMessage& message, cons
case WSAPI_ClientMessage::Type::GetWallpaper:
CEventLoop::current().post_event(*this, make<WSAPIGetWallpaperRequest>(client_id()));
break;
case WSAPI_ClientMessage::Type::SetResolution:
CEventLoop::current().post_event(*this, make<WSAPISetResolutionRequest>(client_id(), message.wm_conf.resolution.width, message.wm_conf.resolution.height));
break;
case WSAPI_ClientMessage::Type::SetWindowOverrideCursor:
CEventLoop::current().post_event(*this, make<WSAPISetWindowOverrideCursorRequest>(client_id(), message.window_id, (WSStandardCursor)message.cursor.cursor));
break;
@ -557,6 +560,15 @@ void WSClientConnection::handle_request(const WSAPIGetWallpaperRequest&)
post_message(response);
}
void WSClientConnection::handle_request(const WSAPISetResolutionRequest& request)
{
WSWindowManager::the().set_resolution(request.resolution().width(), request.resolution().height());
WSAPI_ServerMessage response;
response.type = WSAPI_ServerMessage::Type::DidSetResolution;
response.value = true;
post_message(response);
}
void WSClientConnection::handle_request(const WSAPISetWindowTitleRequest& request)
{
int window_id = request.window_id();
@ -984,6 +996,8 @@ void WSClientConnection::on_request(const WSAPIClientRequest& request)
return handle_request(static_cast<const WSAPISetWallpaperRequest&>(request));
case WSEvent::APIGetWallpaperRequest:
return handle_request(static_cast<const WSAPIGetWallpaperRequest&>(request));
case WSEvent::APISetResolutionRequest:
return handle_request(static_cast<const WSAPISetResolutionRequest&>(request));
case WSEvent::APISetWindowOverrideCursorRequest:
return handle_request(static_cast<const WSAPISetWindowOverrideCursorRequest&>(request));
case WSEvent::WMAPISetActiveWindowRequest: