The Pedigree Project  0.1
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/types.h"
24 
25 #include "pedigree/native/graphics/Graphics.h"
26 #include "pedigree/native/ipc/Ipc.h"
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 "unix»/winman.sock"
38 #define CLIENT_SOCKET_BASE "unix»/winman-client-%s.sock"
39 #endif
40 
41 namespace LibUiProtocol
42 {
44 bool sendMessage(void *pMessage, size_t messageLength);
45 
47 bool recvMessage(
48  PedigreeIpc::IpcEndpoint *endpoint, void *pBuffer, size_t maxSize);
49 
51 bool recvMessageAsync(
52  PedigreeIpc::IpcEndpoint *endpoint, void *pBuffer, size_t maxSize);
53 
55 typedef uint64_t handle_t;
56 
57 enum ButtonState
58 {
59  Down,
60  Up,
61  Unchanged
62 };
63 
64 enum MessageIdentifiers
65 {
71  LargeBufferPrepare,
72 
77  Create,
78 
83  Reposition,
84 
90  Sync,
91 
96  SetProperty,
97 
102  GetProperty,
103 
107  SetTitle,
108 
114  RequestRedraw,
115 
120  SetVisibility,
121 
127  Destroy,
128 
132  MouseEvent,
133 
138  KeyEvent,
139 
144  RawKeyEvent,
145 
150  Focus,
151 
156  NoFocus,
157 
161  Nothing
162 };
163 
166 {
168  MessageIdentifiers messageCode;
169 
171  handle_t widgetHandle;
172 
174  size_t messageSize;
175 
178 };
179 
182 {
185 
187  uintptr_t bufferAddress;
188 
190  size_t bufferLength;
191 };
192 
195 {
197  char endpoint[256];
198 
200  char title[256];
201 
203  size_t minWidth;
204  size_t minHeight;
205 
207  bool rigid;
208 };
209 
212 {
213 };
214 
217 {
220 
223 
225  size_t shmem_size;
226 };
227 
230 {
231 };
232 
235 {
240 };
241 
247 {
248  char propertyName[256];
249  size_t valueLength;
250 };
251 
254 {
255  char propertyName[256];
256  size_t maxValueLength;
257 };
258 
263 {
264  char newTitle[512];
265 };
266 
269 {
270  handle_t newParent;
271 };
272 
275 {
276  handle_t parent;
277 };
278 
281 {
282  size_t x;
283  size_t y;
284  size_t width;
285  size_t height;
286 };
287 
290 {
291  bool bVisible;
292 };
293 
296 {
297 };
298 
301 {
302  size_t x;
303  size_t y;
304 
308 
309  ButtonState buttons[8];
310 };
311 
314 {
315  ButtonState state;
316  uint64_t key;
317 };
318 
321 {
322  ButtonState state;
323  uint16_t scancode;
324 };
325 }; // namespace LibUiProtocol
326 
329 #endif
PedigreeGraphics::Rect rt
New rect.
Definition: protocol.h:219
bool rigid
A &#39;rigid&#39; window cannot be resized by the window manager.
Definition: protocol.h:207
void * shmem_handle
New handle for the shared memory space.
Definition: protocol.h:222
size_t bufferLength
Length of the buffer (in & out).
Definition: protocol.h:190
handle_t widgetHandle
Handle for the widget being referred to. Zero if no widget.
Definition: protocol.h:171
size_t messageSize
Size of the data in the message (after this header).
Definition: protocol.h:174
size_t shmem_size
Size of the framebuffer.
Definition: protocol.h:225
size_t minWidth
Minimum width and height for the window.
Definition: protocol.h:203
bool bIsResponse
Whether this is a response or a request.
Definition: protocol.h:184
MessageIdentifiers messageCode
Code of the message being sent.
Definition: protocol.h:168
uintptr_t bufferAddress
Address off the large buffer. Null in a request.
Definition: protocol.h:187
bool isResponse
Whether this message is a response from the window manager or not.
Definition: protocol.h:177
PedigreeGraphics::GraphicsProvider provider
Definition: protocol.h:239