neuswc

patched neuswc library (tracked)
git clone https://git.daat.foo/neuswc.git
Log | Files | Refs | README | LICENSE

peer_protocol.h (2031B)


      1 /* swc: libswc/peer_protocol.h
      2  *
      3  * the peer backend and the program that shows its frames and sends it input,
      4  * its peer, over a stream socket: SWC_PEER_SOCKET, a path, or @name in
      5  * linux's abstract namespace. the peer listens, swc connects. every message
      6  * is one struct swc_peer_message in the machine's byte order; the one from
      7  * swc that carries a descriptor, open to be read only, carries it with its
      8  * first byte (SCM_RIGHTS)
      9  *
     10  * the peer's first message is SWC_PEER_SIZE. swc then sends SWC_PEER_BUFFER
     11  * and, as the screen changes, SWC_PEER_FRAME. it draws the next frame only
     12  * after SWC_PEER_DONE, and none while the peer says it is hidden. the
     13  * session ends when the socket closes
     14  */
     15 
     16 #ifndef SWC_PEER_PROTOCOL_H
     17 #define SWC_PEER_PROTOCOL_H
     18 
     19 #include <stdint.h>
     20 
     21 enum {
     22 	/* from swc: a shared memory descriptor holding the screen, one
     23 	 * XRGB8888 pixel a 32 bit word: arg width, height, bytes per row.
     24 	 * it replaces any before it */
     25 	SWC_PEER_BUFFER = 1,
     26 	/* from swc: the buffer changed in x y width height. the peer reads it
     27 	 * until it answers SWC_PEER_DONE */
     28 	SWC_PEER_FRAME = 2,
     29 
     30 	/* from the peer: the screen's size in pixels, at the start and when
     31 	 * it changes: arg width, height */
     32 	SWC_PEER_SIZE = 16,
     33 	/* the last frame has been taken */
     34 	SWC_PEER_DONE = 17,
     35 	/* arg 1 when the screen is seen, 0 when it is not */
     36 	SWC_PEER_SHOWN = 18,
     37 	/* arg slot, phase (SWC_PEER_DOWN...), x, y in screen pixels */
     38 	SWC_PEER_TOUCH = 19,
     39 	/* the touches since the last one happened together */
     40 	SWC_PEER_TOUCH_FRAME = 20,
     41 	/* arg linux evdev code, 1 pressed or 0 let go */
     42 	SWC_PEER_KEY = 21,
     43 	/* a mouse: arg x, y in screen pixels */
     44 	SWC_PEER_MOTION = 22,
     45 	/* arg linux evdev button, 1 pressed or 0 let go */
     46 	SWC_PEER_BUTTON = 23,
     47 	/* arg wl_pointer axis, the distance as wl_fixed_t */
     48 	SWC_PEER_SCROLL = 24,
     49 };
     50 
     51 /* phases of SWC_PEER_TOUCH */
     52 enum { SWC_PEER_DOWN = 0, SWC_PEER_MOVE = 1, SWC_PEER_UP = 2, SWC_PEER_CANCEL = 3 };
     53 
     54 struct swc_peer_message {
     55 	uint32_t type;
     56 	int32_t arg[5];
     57 };
     58 
     59 #endif