Serenity Operating System
1/*
2 * Copyright (c) 2018-2020, Andreas Kling <kling@serenityos.org>
3 * All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
7 *
8 * 1. Redistributions of source code must retain the above copyright notice, this
9 * list of conditions and the following disclaimer.
10 *
11 * 2. Redistributions in binary form must reproduce the above copyright notice,
12 * this list of conditions and the following disclaimer in the documentation
13 * and/or other materials provided with the distribution.
14 *
15 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
16 * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
17 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
18 * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
19 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
20 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
21 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
22 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
23 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
25 */
26
27#pragma once
28
29#include <LibIPC/ServerConnection.h>
30#include <WindowServer/WindowClientEndpoint.h>
31#include <WindowServer/WindowServerEndpoint.h>
32
33namespace GUI {
34
35class WindowServerConnection
36 : public IPC::ServerConnection<WindowClientEndpoint, WindowServerEndpoint>
37 , public WindowClientEndpoint {
38 C_OBJECT(WindowServerConnection)
39public:
40 WindowServerConnection()
41 : IPC::ServerConnection<WindowClientEndpoint, WindowServerEndpoint>(*this, "/tmp/portal/window")
42 {
43 handshake();
44 }
45
46 virtual void handshake() override;
47 static WindowServerConnection& the();
48
49private:
50 virtual void handle(const Messages::WindowClient::Paint&) override;
51 virtual void handle(const Messages::WindowClient::MouseMove&) override;
52 virtual void handle(const Messages::WindowClient::MouseDown&) override;
53 virtual void handle(const Messages::WindowClient::MouseDoubleClick&) override;
54 virtual void handle(const Messages::WindowClient::MouseUp&) override;
55 virtual void handle(const Messages::WindowClient::MouseWheel&) override;
56 virtual void handle(const Messages::WindowClient::WindowEntered&) override;
57 virtual void handle(const Messages::WindowClient::WindowLeft&) override;
58 virtual void handle(const Messages::WindowClient::KeyDown&) override;
59 virtual void handle(const Messages::WindowClient::KeyUp&) override;
60 virtual void handle(const Messages::WindowClient::WindowActivated&) override;
61 virtual void handle(const Messages::WindowClient::WindowDeactivated&) override;
62 virtual void handle(const Messages::WindowClient::WindowCloseRequest&) override;
63 virtual void handle(const Messages::WindowClient::WindowResized&) override;
64 virtual void handle(const Messages::WindowClient::MenuItemActivated&) override;
65 virtual void handle(const Messages::WindowClient::ScreenRectChanged&) override;
66 virtual void handle(const Messages::WindowClient::ClipboardContentsChanged&) override;
67 virtual void handle(const Messages::WindowClient::WM_WindowRemoved&) override;
68 virtual void handle(const Messages::WindowClient::WM_WindowStateChanged&) override;
69 virtual void handle(const Messages::WindowClient::WM_WindowIconBitmapChanged&) override;
70 virtual void handle(const Messages::WindowClient::WM_WindowRectChanged&) override;
71 virtual void handle(const Messages::WindowClient::AsyncSetWallpaperFinished&) override;
72 virtual void handle(const Messages::WindowClient::DragDropped&) override;
73 virtual void handle(const Messages::WindowClient::DragAccepted&) override;
74 virtual void handle(const Messages::WindowClient::DragCancelled&) override;
75 virtual void handle(const Messages::WindowClient::UpdateSystemTheme&) override;
76 virtual void handle(const Messages::WindowClient::WindowStateChanged&) override;
77};
78
79}