/* * Copyright (C) 2020-2022 The opuntiaOS Project Authors. * + Contributed by Nikita Melekhin * * Use of this source code is governed by a BSD-style license that can be * found in the LICENSE file. */ #include #include #include namespace UI { App* s_UI_App_the = nullptr; App::App() : m_event_loop() , m_server_connection(socket(PF_LOCAL, 0, 0)) { s_UI_App_the = this; } void App::receive_event(std::unique_ptr event) { if (event->type() == Event::Type::WindowCloseRequestEvent) { // TODO: Only 1 window is supported for now WindowCloseRequestEvent& own_event = *(WindowCloseRequestEvent*)event.get(); auto message = DestroyWindowMessage(m_server_connection.key(), own_event.window_id()); auto reply = m_server_connection.send_sync_message(message); m_event_loop.stop(reply->status()); } } } // namespace UI