The Pedigree Project 0.1
libui/include/protocol.h
1/*
2 * Copyright (c) 2008-2014, Pedigree Developers
3 *
4 * Please see the CONTRIB file in the root of the source tree for a full
5 * list of contributors.
6 *
7 * Permission to use, copy, modify, and distribute this software for any
8 * purpose with or without fee is hereby granted, provided that the above
9 * copyright notice and this permission notice appear in all copies.
10 *
11 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
12 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
13 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
14 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
15 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
16 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
17 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
18 */
19
20#ifndef LIBUI_PROTOCOL_H
21#define LIBUI_PROTOCOL_H
22
23#include "pedigree/native/graphics/Graphics.h"
24#include "pedigree/native/ipc/Ipc.h"
25#include "pedigree/native/types.h"
26
27#include <Widget.h>
28
33#ifdef TARGET_LINUX
34#define WINMAN_SOCKET_PATH "sockets/winman.sock"
35#define CLIENT_SOCKET_BASE "sockets/winman-client-%s.sock"
36#else
37#define WINMAN_SOCKET_PATH "/run/sockets/winman.sock"
38#define CLIENT_SOCKET_BASE "/run/sockets/winman-client-%s.sock"
39#endif
40
41namespace LibUiProtocol {
43bool sendMessage(void* pMessage, size_t messageLength);
44
46bool recvMessage(PedigreeIpc::IpcEndpoint* endpoint, void* pBuffer, size_t maxSize);
47
49bool recvMessageAsync(PedigreeIpc::IpcEndpoint* endpoint, void* pBuffer, size_t maxSize);
50
52typedef uint64_t handle_t;
53
54enum ButtonState { Down, Up, Unchanged };
55
56enum MessageIdentifiers {
62 LargeBufferPrepare,
63
68 Create,
69
74 Reposition,
75
81 Sync,
82
87 SetProperty,
88
93 GetProperty,
94
98 SetTitle,
99
105 RequestRedraw,
106
111 SetVisibility,
112
118 Destroy,
119
123 MouseEvent,
124
129 KeyEvent,
130
135 RawKeyEvent,
136
141 Focus,
142
147 NoFocus,
148
152 Nothing
153};
154
158 MessageIdentifiers messageCode;
159
161 handle_t widgetHandle;
162
165
168};
169
174
176 uintptr_t bufferAddress;
177
180};
181
185 char endpoint[256];
186
188 char title[256];
189
191 size_t minWidth;
192 size_t minHeight;
193
195 bool rigid;
196};
197
200
212
214struct SyncMessage {};
215
223
229 char propertyName[256];
230 size_t valueLength;
231};
232
235 char propertyName[256];
236 size_t maxValueLength;
237};
238
243 char newTitle[512];
244};
245
248 handle_t newParent;
249};
250
253 handle_t parent;
254};
255
258 size_t x;
259 size_t y;
260 size_t width;
261 size_t height;
262};
263
266 bool bVisible;
267};
268
271
274 size_t x;
275 size_t y;
276
280
281 ButtonState buttons[8];
282};
283
286 ButtonState state;
287 uint64_t key;
288};
289
292 ButtonState state;
293 uint16_t scancode;
294};
295}; // namespace LibUiProtocol
296
299#endif
char endpoint[256]
IPC endpoint for this widget.
bool rigid
A 'rigid' window cannot be resized by the window manager.
size_t minWidth
Minimum width and height for the window.
char title[256]
Initial title for this widget.
bool bIsResponse
Whether this is a response or a request.
size_t bufferLength
Length of the buffer (in & out).
uintptr_t bufferAddress
Address off the large buffer. Null in a request.
size_t shmem_size
Size of the framebuffer.
void * shmem_handle
New handle for the shared memory space.
PedigreeGraphics::Rect rt
New rect.
PedigreeGraphics::GraphicsProvider provider
size_t messageSize
Size of the data in the message (after this header).
handle_t widgetHandle
Handle for the widget being referred to. Zero if no widget.
bool isResponse
Whether this message is a response from the window manager or not.
MessageIdentifiers messageCode
Code of the message being sent.