WindowServer: Don't kill window on key event, instead send close event

This allows notifying the client about window close and let client
handle it as it wants
This commit is contained in:
Bananymous 2024-10-18 17:17:58 +03:00
parent 988f7b0561
commit d57e797147
1 changed files with 5 additions and 2 deletions

View File

@ -224,8 +224,11 @@ void WindowServer::on_key_event(LibInput::KeyEvent event)
// Kill window with mod+Q
if (m_is_mod_key_held && event.pressed() && event.key == LibInput::Key::Q)
{
if (m_focused_window)
remove_client_fd(m_focused_window->client_fd());
if (!m_focused_window)
return;
LibGUI::EventPacket::CloseWindowEvent packet;
if (auto ret = packet.send_serialized(m_focused_window->client_fd()); ret.is_error())
dwarnln("could not send window close event: {}", ret.error());
return;
}