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

WindowServer+LibGUI: Add a way to bring a window to the front.

GWindow::move_to_front() can now be used to move a window to the top of
the window stack.

We use this in Terminal to bring the settings window to the front if it
already exists when it's requested, in case it's hiding behind something.
This commit is contained in:
Andreas Kling 2019-06-01 20:10:37 +02:00
parent 8d7fbbe1fb
commit 51581c21fc
8 changed files with 47 additions and 0 deletions

View file

@ -329,6 +329,18 @@ void WSClientConnection::handle_request(const WSAPIAddMenuSeparatorRequest& requ
post_message(response);
}
void WSClientConnection::handle_request(const WSAPIMoveWindowToFrontRequest& request)
{
int window_id = request.window_id();
auto it = m_windows.find(window_id);
if (it == m_windows.end()) {
post_error("WSAPIMoveWindowToFrontRequest: Bad window ID");
return;
}
auto& window = *(*it).value;
WSWindowManager::the().move_to_front_and_make_active(window);
}
void WSClientConnection::handle_request(const WSAPISetWindowOpacityRequest& request)
{
int window_id = request.window_id();
@ -786,6 +798,8 @@ void WSClientConnection::on_request(const WSAPIClientRequest& request)
return handle_request(static_cast<const WSAPIDismissMenuRequest&>(request));
case WSEvent::APISetWindowHasAlphaChannelRequest:
return handle_request(static_cast<const WSAPISetWindowHasAlphaChannelRequest&>(request));
case WSEvent::APIMoveWindowToFrontRequest:
return handle_request(static_cast<const WSAPIMoveWindowToFrontRequest&>(request));
default:
break;
}