2012-12-20 12:07:29 +00:00
|
|
|
#ifndef __BROADWAY_PROTOCOL_H__
|
|
|
|
#define __BROADWAY_PROTOCOL_H__
|
|
|
|
|
|
|
|
#include <glib.h>
|
|
|
|
|
2012-12-21 23:02:55 +00:00
|
|
|
typedef struct {
|
|
|
|
gint32 x, y;
|
|
|
|
gint32 width, height;
|
|
|
|
} BroadwayRect;
|
|
|
|
|
2017-11-21 18:33:12 +00:00
|
|
|
typedef enum { /* Sync changes with broadway.js */
|
2017-11-22 09:32:47 +00:00
|
|
|
BROADWAY_NODE_TEXTURE = 0,
|
|
|
|
BROADWAY_NODE_CONTAINER = 1,
|
|
|
|
BROADWAY_NODE_COLOR = 2,
|
|
|
|
BROADWAY_NODE_BORDER = 3,
|
|
|
|
BROADWAY_NODE_OUTSET_SHADOW = 4,
|
|
|
|
BROADWAY_NODE_INSET_SHADOW = 5,
|
|
|
|
BROADWAY_NODE_ROUNDED_CLIP = 6,
|
2017-11-22 11:31:36 +00:00
|
|
|
BROADWAY_NODE_LINEAR_GRADIENT = 7,
|
2017-11-22 15:53:15 +00:00
|
|
|
BROADWAY_NODE_SHADOW = 8,
|
2017-11-22 16:28:44 +00:00
|
|
|
BROADWAY_NODE_OPACITY = 9,
|
2017-11-22 16:40:39 +00:00
|
|
|
BROADWAY_NODE_CLIP = 10,
|
2019-03-28 15:03:42 +00:00
|
|
|
BROADWAY_NODE_TRANSFORM = 11,
|
|
|
|
BROADWAY_NODE_DEBUG = 12,
|
|
|
|
BROADWAY_NODE_REUSE = 13,
|
2017-11-21 18:33:12 +00:00
|
|
|
} BroadwayNodeType;
|
|
|
|
|
2019-03-28 15:03:42 +00:00
|
|
|
typedef enum { /* Sync changes with broadway.js */
|
2019-03-28 18:17:01 +00:00
|
|
|
BROADWAY_NODE_OP_INSERT_NODE = 0,
|
2019-03-28 15:03:42 +00:00
|
|
|
BROADWAY_NODE_OP_REMOVE_NODE = 1,
|
2019-03-28 18:17:01 +00:00
|
|
|
BROADWAY_NODE_OP_MOVE_AFTER_CHILD = 2,
|
2019-03-28 19:22:44 +00:00
|
|
|
BROADWAY_NODE_OP_PATCH_TEXTURE = 3,
|
|
|
|
BROADWAY_NODE_OP_PATCH_TRANSFORM = 4,
|
2019-03-28 15:03:42 +00:00
|
|
|
} BroadwayNodeOpType;
|
|
|
|
|
2017-11-30 16:50:46 +00:00
|
|
|
static const char *broadway_node_type_names[] G_GNUC_UNUSED = {
|
|
|
|
"TEXTURE",
|
|
|
|
"CONTAINER",
|
|
|
|
"COLOR",
|
|
|
|
"BORDER",
|
|
|
|
"OUTSET_SHADOW",
|
|
|
|
"INSET_SHADOW",
|
|
|
|
"ROUNDED_CLIP",
|
|
|
|
"LINEAR_GRADIENT",
|
|
|
|
"SHADOW",
|
|
|
|
"OPACITY",
|
|
|
|
"CLIP",
|
2019-03-28 09:37:21 +00:00
|
|
|
"TRANSFORM",
|
2019-03-22 11:42:12 +00:00
|
|
|
"DEBUG",
|
2019-03-28 09:37:21 +00:00
|
|
|
"REUSE",
|
2017-11-30 16:50:46 +00:00
|
|
|
};
|
|
|
|
|
2012-12-20 12:40:31 +00:00
|
|
|
typedef enum {
|
2019-03-29 10:44:46 +00:00
|
|
|
BROADWAY_EVENT_ENTER = 0,
|
|
|
|
BROADWAY_EVENT_LEAVE = 1,
|
|
|
|
BROADWAY_EVENT_POINTER_MOVE = 2,
|
|
|
|
BROADWAY_EVENT_BUTTON_PRESS = 3,
|
|
|
|
BROADWAY_EVENT_BUTTON_RELEASE = 4,
|
|
|
|
BROADWAY_EVENT_TOUCH = 5,
|
|
|
|
BROADWAY_EVENT_SCROLL = 6,
|
|
|
|
BROADWAY_EVENT_KEY_PRESS = 7,
|
|
|
|
BROADWAY_EVENT_KEY_RELEASE = 8,
|
|
|
|
BROADWAY_EVENT_GRAB_NOTIFY = 9,
|
|
|
|
BROADWAY_EVENT_UNGRAB_NOTIFY = 10,
|
|
|
|
BROADWAY_EVENT_CONFIGURE_NOTIFY = 11,
|
|
|
|
BROADWAY_EVENT_SCREEN_SIZE_CHANGED = 12,
|
|
|
|
BROADWAY_EVENT_FOCUS = 13,
|
|
|
|
BROADWAY_EVENT_ROUNDTRIP_NOTIFY = 14,
|
2012-12-20 12:40:31 +00:00
|
|
|
} BroadwayEventType;
|
|
|
|
|
2012-12-20 13:20:20 +00:00
|
|
|
typedef enum {
|
2019-03-29 10:44:46 +00:00
|
|
|
BROADWAY_OP_GRAB_POINTER = 0,
|
|
|
|
BROADWAY_OP_UNGRAB_POINTER = 1,
|
|
|
|
BROADWAY_OP_NEW_SURFACE = 2,
|
|
|
|
BROADWAY_OP_SHOW_SURFACE = 3,
|
|
|
|
BROADWAY_OP_HIDE_SURFACE = 4,
|
|
|
|
BROADWAY_OP_RAISE_SURFACE = 5,
|
|
|
|
BROADWAY_OP_LOWER_SURFACE = 6,
|
|
|
|
BROADWAY_OP_DESTROY_SURFACE = 7,
|
|
|
|
BROADWAY_OP_MOVE_RESIZE = 8,
|
|
|
|
BROADWAY_OP_SET_TRANSIENT_FOR = 9,
|
|
|
|
BROADWAY_OP_DISCONNECTED = 10,
|
|
|
|
BROADWAY_OP_SURFACE_UPDATE = 11,
|
|
|
|
BROADWAY_OP_SET_SHOW_KEYBOARD = 12,
|
|
|
|
BROADWAY_OP_UPLOAD_TEXTURE = 13,
|
|
|
|
BROADWAY_OP_RELEASE_TEXTURE = 14,
|
|
|
|
BROADWAY_OP_SET_NODES = 15,
|
|
|
|
BROADWAY_OP_ROUNDTRIP = 16,
|
2012-12-20 13:20:20 +00:00
|
|
|
} BroadwayOpType;
|
|
|
|
|
2012-12-20 12:07:29 +00:00
|
|
|
typedef struct {
|
2013-01-08 16:32:27 +00:00
|
|
|
guint32 type;
|
2012-12-20 12:07:29 +00:00
|
|
|
guint32 serial;
|
|
|
|
guint64 time;
|
|
|
|
} BroadwayInputBaseMsg;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
BroadwayInputBaseMsg base;
|
2017-12-05 13:38:57 +00:00
|
|
|
guint32 mouse_surface_id; /* The real surface, not taking grabs into account */
|
|
|
|
guint32 event_surface_id;
|
2012-12-20 12:07:29 +00:00
|
|
|
gint32 root_x;
|
|
|
|
gint32 root_y;
|
|
|
|
gint32 win_x;
|
|
|
|
gint32 win_y;
|
|
|
|
guint32 state;
|
|
|
|
} BroadwayInputPointerMsg;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
BroadwayInputPointerMsg pointer;
|
|
|
|
guint32 mode;
|
|
|
|
} BroadwayInputCrossingMsg;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
BroadwayInputPointerMsg pointer;
|
|
|
|
guint32 button;
|
|
|
|
} BroadwayInputButtonMsg;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
BroadwayInputPointerMsg pointer;
|
|
|
|
gint32 dir;
|
|
|
|
} BroadwayInputScrollMsg;
|
|
|
|
|
2013-11-12 15:11:15 +00:00
|
|
|
typedef struct {
|
|
|
|
BroadwayInputBaseMsg base;
|
|
|
|
guint32 touch_type;
|
2017-12-05 13:38:57 +00:00
|
|
|
guint32 event_surface_id;
|
2013-11-12 15:11:15 +00:00
|
|
|
guint32 sequence_id;
|
2013-11-14 10:03:10 +00:00
|
|
|
guint32 is_emulated;
|
2013-11-12 15:11:15 +00:00
|
|
|
gint32 root_x;
|
|
|
|
gint32 root_y;
|
|
|
|
gint32 win_x;
|
|
|
|
gint32 win_y;
|
|
|
|
guint32 state;
|
|
|
|
} BroadwayInputTouchMsg;
|
|
|
|
|
2012-12-20 12:07:29 +00:00
|
|
|
typedef struct {
|
|
|
|
BroadwayInputBaseMsg base;
|
2017-12-05 13:38:57 +00:00
|
|
|
guint32 surface_id;
|
2012-12-20 12:07:29 +00:00
|
|
|
guint32 state;
|
|
|
|
gint32 key;
|
|
|
|
} BroadwayInputKeyMsg;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
BroadwayInputBaseMsg base;
|
|
|
|
gint32 res;
|
|
|
|
} BroadwayInputGrabReply;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
BroadwayInputBaseMsg base;
|
|
|
|
gint32 id;
|
|
|
|
gint32 x;
|
|
|
|
gint32 y;
|
|
|
|
gint32 width;
|
|
|
|
gint32 height;
|
|
|
|
} BroadwayInputConfigureNotify;
|
|
|
|
|
2017-11-23 09:22:23 +00:00
|
|
|
typedef struct {
|
|
|
|
BroadwayInputBaseMsg base;
|
|
|
|
gint32 id;
|
|
|
|
guint32 tag;
|
|
|
|
guint32 local;
|
|
|
|
} BroadwayInputRoundtripNotify;
|
|
|
|
|
2012-12-20 12:07:29 +00:00
|
|
|
typedef struct {
|
|
|
|
BroadwayInputBaseMsg base;
|
2013-01-08 16:56:39 +00:00
|
|
|
guint32 width;
|
|
|
|
guint32 height;
|
2020-03-12 10:12:01 +00:00
|
|
|
guint32 scale;
|
2012-12-20 12:07:29 +00:00
|
|
|
} BroadwayInputScreenResizeNotify;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
BroadwayInputBaseMsg base;
|
|
|
|
gint32 id;
|
|
|
|
} BroadwayInputDeleteNotify;
|
|
|
|
|
2013-11-12 11:03:50 +00:00
|
|
|
typedef struct {
|
|
|
|
BroadwayInputBaseMsg base;
|
2013-11-13 11:10:29 +00:00
|
|
|
gint32 new_id;
|
|
|
|
gint32 old_id;
|
2013-11-12 11:03:50 +00:00
|
|
|
} BroadwayInputFocusMsg;
|
|
|
|
|
2012-12-20 12:07:29 +00:00
|
|
|
typedef union {
|
|
|
|
BroadwayInputBaseMsg base;
|
|
|
|
BroadwayInputPointerMsg pointer;
|
|
|
|
BroadwayInputCrossingMsg crossing;
|
|
|
|
BroadwayInputButtonMsg button;
|
|
|
|
BroadwayInputScrollMsg scroll;
|
2013-11-12 15:11:15 +00:00
|
|
|
BroadwayInputTouchMsg touch;
|
2012-12-20 12:07:29 +00:00
|
|
|
BroadwayInputKeyMsg key;
|
|
|
|
BroadwayInputGrabReply grab_reply;
|
|
|
|
BroadwayInputConfigureNotify configure_notify;
|
2017-11-23 09:22:23 +00:00
|
|
|
BroadwayInputRoundtripNotify roundtrip_notify;
|
2012-12-20 12:07:29 +00:00
|
|
|
BroadwayInputDeleteNotify delete_notify;
|
|
|
|
BroadwayInputScreenResizeNotify screen_resize_notify;
|
2013-11-12 11:03:50 +00:00
|
|
|
BroadwayInputFocusMsg focus;
|
2012-12-20 12:07:29 +00:00
|
|
|
} BroadwayInputMsg;
|
|
|
|
|
2012-12-21 23:02:55 +00:00
|
|
|
typedef enum {
|
2017-12-05 13:38:57 +00:00
|
|
|
BROADWAY_REQUEST_NEW_SURFACE,
|
2012-12-21 23:02:55 +00:00
|
|
|
BROADWAY_REQUEST_FLUSH,
|
|
|
|
BROADWAY_REQUEST_SYNC,
|
|
|
|
BROADWAY_REQUEST_QUERY_MOUSE,
|
2017-12-05 13:38:57 +00:00
|
|
|
BROADWAY_REQUEST_DESTROY_SURFACE,
|
|
|
|
BROADWAY_REQUEST_SHOW_SURFACE,
|
|
|
|
BROADWAY_REQUEST_HIDE_SURFACE,
|
2012-12-21 23:02:55 +00:00
|
|
|
BROADWAY_REQUEST_SET_TRANSIENT_FOR,
|
|
|
|
BROADWAY_REQUEST_MOVE_RESIZE,
|
|
|
|
BROADWAY_REQUEST_GRAB_POINTER,
|
2013-11-12 11:03:50 +00:00
|
|
|
BROADWAY_REQUEST_UNGRAB_POINTER,
|
2017-12-05 13:38:57 +00:00
|
|
|
BROADWAY_REQUEST_FOCUS_SURFACE,
|
2017-11-17 15:40:06 +00:00
|
|
|
BROADWAY_REQUEST_SET_SHOW_KEYBOARD,
|
|
|
|
BROADWAY_REQUEST_UPLOAD_TEXTURE,
|
|
|
|
BROADWAY_REQUEST_RELEASE_TEXTURE,
|
2017-11-21 18:33:12 +00:00
|
|
|
BROADWAY_REQUEST_SET_NODES,
|
2017-11-23 09:22:23 +00:00
|
|
|
BROADWAY_REQUEST_ROUNDTRIP,
|
2012-12-21 23:02:55 +00:00
|
|
|
} BroadwayRequestType;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
guint32 size;
|
|
|
|
guint32 serial;
|
|
|
|
guint32 type;
|
|
|
|
} BroadwayRequestBase, BroadwayRequestFlush, BroadwayRequestSync, BroadwayRequestQueryMouse;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
BroadwayRequestBase base;
|
|
|
|
guint32 id;
|
2017-12-05 13:38:57 +00:00
|
|
|
} BroadwayRequestDestroySurface, BroadwayRequestShowSurface, BroadwayRequestHideSurface, BroadwayRequestFocusSurface;
|
2012-12-21 23:02:55 +00:00
|
|
|
|
2017-11-23 09:22:23 +00:00
|
|
|
typedef struct {
|
|
|
|
BroadwayRequestBase base;
|
|
|
|
guint32 id;
|
|
|
|
guint32 tag;
|
|
|
|
} BroadwayRequestRoundtrip;
|
|
|
|
|
2012-12-21 23:02:55 +00:00
|
|
|
typedef struct {
|
|
|
|
BroadwayRequestBase base;
|
|
|
|
guint32 id;
|
|
|
|
guint32 parent;
|
|
|
|
} BroadwayRequestSetTransientFor;
|
|
|
|
|
2017-11-17 15:40:06 +00:00
|
|
|
typedef struct {
|
|
|
|
BroadwayRequestBase base;
|
|
|
|
guint32 id;
|
|
|
|
guint32 offset;
|
|
|
|
guint32 size;
|
|
|
|
} BroadwayRequestUploadTexture;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
BroadwayRequestBase base;
|
|
|
|
guint32 id;
|
|
|
|
} BroadwayRequestReleaseTexture;
|
|
|
|
|
2017-11-21 18:33:12 +00:00
|
|
|
typedef struct {
|
|
|
|
BroadwayRequestBase base;
|
|
|
|
guint32 id;
|
|
|
|
guint32 data[1];
|
|
|
|
} BroadwayRequestSetNodes;
|
|
|
|
|
|
|
|
|
2012-12-21 23:02:55 +00:00
|
|
|
typedef struct {
|
|
|
|
BroadwayRequestBase base;
|
|
|
|
guint32 id;
|
|
|
|
guint32 owner_events;
|
|
|
|
guint32 event_mask;
|
|
|
|
guint32 time_;
|
|
|
|
} BroadwayRequestGrabPointer;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
BroadwayRequestBase base;
|
|
|
|
guint32 time_;
|
|
|
|
} BroadwayRequestUngrabPointer;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
BroadwayRequestBase base;
|
|
|
|
gint32 x;
|
|
|
|
gint32 y;
|
|
|
|
guint32 width;
|
|
|
|
guint32 height;
|
|
|
|
guint32 is_temp;
|
2017-12-05 13:38:57 +00:00
|
|
|
} BroadwayRequestNewSurface;
|
2012-12-21 23:02:55 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
BroadwayRequestBase base;
|
|
|
|
guint32 id;
|
2013-01-08 16:33:29 +00:00
|
|
|
guint32 with_move;
|
2012-12-21 23:02:55 +00:00
|
|
|
gint32 x;
|
|
|
|
gint32 y;
|
|
|
|
guint32 width;
|
|
|
|
guint32 height;
|
|
|
|
} BroadwayRequestMoveResize;
|
|
|
|
|
2013-11-13 11:20:07 +00:00
|
|
|
typedef struct {
|
|
|
|
BroadwayRequestBase base;
|
|
|
|
guint32 show_keyboard;
|
|
|
|
} BroadwayRequestSetShowKeyboard;
|
|
|
|
|
2012-12-21 23:02:55 +00:00
|
|
|
typedef union {
|
|
|
|
BroadwayRequestBase base;
|
2017-12-05 13:38:57 +00:00
|
|
|
BroadwayRequestNewSurface new_surface;
|
2012-12-21 23:02:55 +00:00
|
|
|
BroadwayRequestFlush flush;
|
|
|
|
BroadwayRequestSync sync;
|
2017-11-23 09:22:23 +00:00
|
|
|
BroadwayRequestRoundtrip roundtrip;
|
2012-12-21 23:02:55 +00:00
|
|
|
BroadwayRequestQueryMouse query_mouse;
|
2017-12-05 13:38:57 +00:00
|
|
|
BroadwayRequestDestroySurface destroy_surface;
|
|
|
|
BroadwayRequestShowSurface show_surface;
|
|
|
|
BroadwayRequestHideSurface hide_surface;
|
2012-12-21 23:02:55 +00:00
|
|
|
BroadwayRequestSetTransientFor set_transient_for;
|
|
|
|
BroadwayRequestMoveResize move_resize;
|
|
|
|
BroadwayRequestGrabPointer grab_pointer;
|
|
|
|
BroadwayRequestUngrabPointer ungrab_pointer;
|
2017-12-05 13:38:57 +00:00
|
|
|
BroadwayRequestFocusSurface focus_surface;
|
2013-11-13 11:20:07 +00:00
|
|
|
BroadwayRequestSetShowKeyboard set_show_keyboard;
|
2017-11-17 15:40:06 +00:00
|
|
|
BroadwayRequestUploadTexture upload_texture;
|
|
|
|
BroadwayRequestReleaseTexture release_texture;
|
2017-11-21 18:33:12 +00:00
|
|
|
BroadwayRequestSetNodes set_nodes;
|
2012-12-21 23:02:55 +00:00
|
|
|
} BroadwayRequest;
|
|
|
|
|
|
|
|
typedef enum {
|
|
|
|
BROADWAY_REPLY_EVENT,
|
|
|
|
BROADWAY_REPLY_SYNC,
|
|
|
|
BROADWAY_REPLY_QUERY_MOUSE,
|
2017-12-05 13:38:57 +00:00
|
|
|
BROADWAY_REPLY_NEW_SURFACE,
|
2012-12-21 23:02:55 +00:00
|
|
|
BROADWAY_REPLY_GRAB_POINTER,
|
|
|
|
BROADWAY_REPLY_UNGRAB_POINTER
|
|
|
|
} BroadwayReplyType;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
guint32 size;
|
|
|
|
guint32 in_reply_to;
|
|
|
|
guint32 type;
|
|
|
|
} BroadwayReplyBase, BroadwayReplySync;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
BroadwayReplyBase base;
|
|
|
|
guint32 id;
|
2017-12-05 13:38:57 +00:00
|
|
|
} BroadwayReplyNewSurface;
|
2012-12-21 23:02:55 +00:00
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
BroadwayReplyBase base;
|
|
|
|
guint32 status;
|
|
|
|
} BroadwayReplyGrabPointer, BroadwayReplyUngrabPointer;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
BroadwayReplyBase base;
|
2017-12-05 13:38:57 +00:00
|
|
|
guint32 surface;
|
2012-12-21 23:02:55 +00:00
|
|
|
gint32 root_x;
|
|
|
|
gint32 root_y;
|
|
|
|
guint32 mask;
|
|
|
|
} BroadwayReplyQueryMouse;
|
|
|
|
|
|
|
|
typedef struct {
|
|
|
|
BroadwayReplyBase base;
|
|
|
|
BroadwayInputMsg msg;
|
|
|
|
} BroadwayReplyEvent;
|
|
|
|
|
|
|
|
typedef union {
|
|
|
|
BroadwayReplyBase base;
|
|
|
|
BroadwayReplyEvent event;
|
|
|
|
BroadwayReplyQueryMouse query_mouse;
|
2017-12-05 13:38:57 +00:00
|
|
|
BroadwayReplyNewSurface new_surface;
|
2012-12-21 23:02:55 +00:00
|
|
|
BroadwayReplyGrabPointer grab_pointer;
|
|
|
|
BroadwayReplyUngrabPointer ungrab_pointer;
|
|
|
|
} BroadwayReply;
|
|
|
|
|
2012-12-20 12:07:29 +00:00
|
|
|
#endif /* __BROADWAY_PROTOCOL_H__ */
|