Summary
Define the protocol for communication between GUI clients and the compositor, including surface creation, buffer attachment, damage reporting, and input delivery.
Background
Inspired by Wayland protocol but simplified for meniOS. Clients send requests, compositor sends events.
Goals
- Define protocol message format
- Surface lifecycle (create, attach, commit, destroy)
- Input event delivery
- Frame callbacks for vsync
- Simple and extensible design
Protocol Messages
Client → Compositor (Requests)
```c
enum request_type {
REQ_CREATE_SURFACE,
REQ_DESTROY_SURFACE,
REQ_ATTACH_BUFFER,
REQ_DAMAGE,
REQ_COMMIT,
REQ_FRAME_CALLBACK
};
struct request {
uint32_t type;
uint32_t surface_id;
union {
struct { // ATTACH_BUFFER
int fd; // Shared memory fd
int width, height;
} attach;
struct { // DAMAGE
int x, y, width, height;
} damage;
};
};
```
Compositor → Client (Events)
```c
enum event_type {
EVT_CONFIGURE,
EVT_KEY,
EVT_MOUSE_MOTION,
EVT_MOUSE_BUTTON,
EVT_FRAME_DONE
};
struct event {
uint32_t type;
uint32_t surface_id;
union {
struct { // CONFIGURE
int width, height;
} configure;
struct { // KEY
uint32_t keycode;
uint32_t state; // pressed/released
} key;
struct { // MOUSE
int x, y;
} mouse;
};
};
```
Timeline
Total: 2-3 weeks
Definition of Done
Dependencies
See docs/road/road_to_gui.md for complete roadmap.
Summary
Define the protocol for communication between GUI clients and the compositor, including surface creation, buffer attachment, damage reporting, and input delivery.
Background
Inspired by Wayland protocol but simplified for meniOS. Clients send requests, compositor sends events.
Goals
Protocol Messages
Client → Compositor (Requests)
```c
enum request_type {
REQ_CREATE_SURFACE,
REQ_DESTROY_SURFACE,
REQ_ATTACH_BUFFER,
REQ_DAMAGE,
REQ_COMMIT,
REQ_FRAME_CALLBACK
};
struct request {
uint32_t type;
uint32_t surface_id;
union {
struct { // ATTACH_BUFFER
int fd; // Shared memory fd
int width, height;
} attach;
struct { // DAMAGE
int x, y, width, height;
} damage;
};
};
```
Compositor → Client (Events)
```c
enum event_type {
EVT_CONFIGURE,
EVT_KEY,
EVT_MOUSE_MOTION,
EVT_MOUSE_BUTTON,
EVT_FRAME_DONE
};
struct event {
uint32_t type;
uint32_t surface_id;
union {
struct { // CONFIGURE
int width, height;
} configure;
struct { // KEY
uint32_t keycode;
uint32_t state; // pressed/released
} key;
struct { // MOUSE
int x, y;
} mouse;
};
};
```
Timeline
Total: 2-3 weeks
Definition of Done
Dependencies
See docs/road/road_to_gui.md for complete roadmap.