1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-28 09:15:07 +00:00

WindowServer+LibGUI: Allow changing whether windows have alpha channels.

Use this in Terminal to tell the window server to not bother with the alpha
channel in the backing store if we're running without transparency.
Semi-transparent terminals look neat but they slow everything down, so this
keeps things fast while making it easy to switch to the flashy mode. :^)
This commit is contained in:
Andreas Kling 2019-05-03 21:07:16 +02:00
parent 2470fdcd9b
commit 6a5d92f0ad
9 changed files with 65 additions and 2 deletions

View file

@ -629,6 +629,24 @@ void WSClientConnection::handle_request(const WSAPISetWindowOverrideCursorReques
window.set_override_cursor(WSCursor::create(request.cursor()));
}
void WSClientConnection::handle_request(const WSAPISetWindowHasAlphaChannelRequest& request)
{
int window_id = request.window_id();
auto it = m_windows.find(window_id);
if (it == m_windows.end()) {
post_error("WSAPISetWindowHasAlphaChannelRequest: Bad window ID");
return;
}
auto& window = *(*it).value;
window.set_has_alpha_channel(request.value());
WSAPI_ServerMessage response;
response.type = WSAPI_ServerMessage::Type::DidSetWindowHasAlphaChannel;
response.window_id = window_id;
response.value = request.value();
post_message(response);
}
void WSClientConnection::handle_request(const WSWMAPISetActiveWindowRequest& request)
{
auto* client = WSClientConnection::from_client_id(request.target_client_id());
@ -747,6 +765,8 @@ void WSClientConnection::on_request(const WSAPIClientRequest& request)
return handle_request(static_cast<const WSAPIPopupMenuRequest&>(request));
case WSEvent::APIDismissMenuRequest:
return handle_request(static_cast<const WSAPIDismissMenuRequest&>(request));
case WSEvent::APISetWindowHasAlphaChannelRequest:
return handle_request(static_cast<const WSAPISetWindowHasAlphaChannelRequest&>(request));
default:
break;
}