mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 19:58:11 +00:00

This change unfortunately cannot be atomically made without a single commit changing everything. Most of the important changes are in LibIPC/Connection.cpp, LibIPC/ServerConnection.cpp and LibCore/LocalServer.cpp. The notable changes are: - IPCCompiler now generates the decode and decode_message functions such that they take a Core::Stream::LocalSocket instead of the socket fd. - IPC::Decoder now uses the receive_fd method of LocalSocket instead of doing system calls directly on the fd. - IPC::ConnectionBase and related classes now use the Stream API functions. - IPC::ServerConnection no longer constructs the socket itself; instead, a convenience macro, IPC_CLIENT_CONNECTION, is used in place of C_OBJECT and will generate a static try_create factory function for the ServerConnection subclass. The subclass is now responsible for passing the socket constructed in this function to its ServerConnection base; the socket is passed as the first argument to the constructor (as a NonnullOwnPtr<Core::Stream::LocalServer>) before any other arguments. - The functionality regarding taking over sockets from SystemServer has been moved to LibIPC/SystemServerTakeover.cpp. The Core::LocalSocket implementation of this functionality hasn't been deleted due to my intention of removing this class in the near future and to reduce noise on this (already quite noisy) PR.
54 lines
1.7 KiB
C++
54 lines
1.7 KiB
C++
/*
|
|
* Copyright (c) 2021, the SerenityOS developers.
|
|
*
|
|
* SPDX-License-Identifier: BSD-2-Clause
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "AK/NonnullRefPtr.h"
|
|
#include <AK/HashMap.h>
|
|
#include <LibIPC/ClientConnection.h>
|
|
#include <WindowServer/WindowManagerClientEndpoint.h>
|
|
#include <WindowServer/WindowManagerServerEndpoint.h>
|
|
|
|
namespace WindowServer {
|
|
|
|
class WMClientConnection final
|
|
: public IPC::ClientConnection<WindowManagerClientEndpoint, WindowManagerServerEndpoint> {
|
|
C_OBJECT(WMClientConnection)
|
|
|
|
public:
|
|
~WMClientConnection() override;
|
|
|
|
virtual void set_active_window(i32, i32) override;
|
|
virtual void set_window_minimized(i32, i32, bool) override;
|
|
virtual void toggle_show_desktop() override;
|
|
virtual void start_window_resize(i32, i32) override;
|
|
virtual void popup_window_menu(i32, i32, Gfx::IntPoint const&) override;
|
|
virtual void set_window_taskbar_rect(i32, i32, Gfx::IntRect const&) override;
|
|
virtual void set_applet_area_position(Gfx::IntPoint const&) override;
|
|
virtual void set_event_mask(u32) override;
|
|
virtual void set_manager_window(i32) override;
|
|
virtual void set_workspace(u32, u32) override;
|
|
|
|
unsigned event_mask() const { return m_event_mask; }
|
|
int window_id() const { return m_window_id; }
|
|
|
|
private:
|
|
explicit WMClientConnection(NonnullOwnPtr<Core::Stream::LocalSocket> client_socket, int client_id);
|
|
|
|
// ^ClientConnection
|
|
virtual void die() override;
|
|
|
|
// RefPtr<Core::Timer> m_ping_timer;
|
|
static HashMap<int, NonnullRefPtr<WMClientConnection>> s_connections;
|
|
unsigned m_event_mask { 0 };
|
|
int m_window_id { -1 };
|
|
|
|
// WindowManager needs to access the window manager clients to notify
|
|
// about events.
|
|
friend class WindowManager;
|
|
};
|
|
|
|
};
|