⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 rfbproto.h

📁 神龙卡开发原代码
💻 H
📖 第 1 页 / 共 2 页
字号:
 * Raw Encoding.  Pixels are sent in top-to-bottom scanline order, * left-to-right within a scanline with no padding in between. *//*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * CopyRect Encoding.  The pixels are specified simply by the x and y position * of the source rectangle. */typedef struct {    CARD16 srcX;    CARD16 srcY;} rfbCopyRect;#define sz_rfbCopyRect 4/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * RRE - Rise-and-Run-length Encoding.  We have an rfbRREHeader structure * giving the number of subrectangles following.  Finally the data follows in * the form [<bgpixel><subrect><subrect>...] where each <subrect> is * [<pixel><rfbRectangle>]. */typedef struct {    CARD32 nSubrects;} rfbRREHeader;#define sz_rfbRREHeader 4/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * CoRRE - Compact RRE Encoding.  We have an rfbRREHeader structure giving * the number of subrectangles following.  Finally the data follows in the form * [<bgpixel><subrect><subrect>...] where each <subrect> is * [<pixel><rfbCoRRERectangle>].  This means that * the whole rectangle must be at most 255x255 pixels. */typedef struct {    CARD8 x;    CARD8 y;    CARD8 w;    CARD8 h;} rfbCoRRERectangle;#define sz_rfbCoRRERectangle 4/*- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - * Hextile Encoding.  The rectangle is divided up into "tiles" of 16x16 pixels, * starting at the top left going in left-to-right, top-to-bottom order.  If * the width of the rectangle is not an exact multiple of 16 then the width of * the last tile in each row will be correspondingly smaller.  Similarly if the * height is not an exact multiple of 16 then the height of each tile in the * final row will also be smaller.  Each tile begins with a "subencoding" type * byte, which is a mask made up of a number of bits.  If the Raw bit is set * then the other bits are irrelevant; w*h pixel values follow (where w and h * are the width and height of the tile).  Otherwise the tile is encoded in a * similar way to RRE, except that the position and size of each subrectangle * can be specified in just two bytes.  The other bits in the mask are as * follows: * * BackgroundSpecified - if set, a pixel value follows which specifies *    the background colour for this tile.  The first non-raw tile in a *    rectangle must have this bit set.  If this bit isn't set then the *    background is the same as the last tile. * * ForegroundSpecified - if set, a pixel value follows which specifies *    the foreground colour to be used for all subrectangles in this tile. *    If this bit is set then the SubrectsColoured bit must be zero. * * AnySubrects - if set, a single byte follows giving the number of *    subrectangles following.  If not set, there are no subrectangles (i.e. *    the whole tile is just solid background colour). * * SubrectsColoured - if set then each subrectangle is preceded by a pixel *    value giving the colour of that subrectangle.  If not set, all *    subrectangles are the same colour, the foreground colour;  if the *    ForegroundSpecified bit wasn't set then the foreground is the same as *    the last tile. * * The position and size of each subrectangle is specified in two bytes.  The * Pack macros below can be used to generate the two bytes from x, y, w, h, * and the Extract macros can be used to extract the x, y, w, h values from * the two bytes. */#define rfbHextileRaw			(1 << 0)#define rfbHextileBackgroundSpecified	(1 << 1)#define rfbHextileForegroundSpecified	(1 << 2)#define rfbHextileAnySubrects		(1 << 3)#define rfbHextileSubrectsColoured	(1 << 4)#define rfbHextilePackXY(x,y) (((x) << 4) | (y))#define rfbHextilePackWH(w,h) ((((w)-1) << 4) | ((h)-1))#define rfbHextileExtractX(byte) ((byte) >> 4)#define rfbHextileExtractY(byte) ((byte) & 0xf)#define rfbHextileExtractW(byte) (((byte) >> 4) + 1)#define rfbHextileExtractH(byte) (((byte) & 0xf) + 1)/*----------------------------------------------------------------------------- * SetColourMapEntries - these messages are only sent if the pixel * format uses a "colour map" (i.e. trueColour false) and the client has not * fixed the entire colour map using FixColourMapEntries.  In addition they * will only start being sent after the client has sent its first * FramebufferUpdateRequest.  So if the client always tells the server to use * trueColour then it never needs to process this type of message. */typedef struct {    CARD8 type;			/* always rfbSetColourMapEntries */    CARD8 pad;    CARD16 firstColour;    CARD16 nColours;    /* Followed by nColours * 3 * CARD16       r1, g1, b1, r2, g2, b2, r3, g3, b3, ..., rn, bn, gn */} rfbSetColourMapEntriesMsg;#define sz_rfbSetColourMapEntriesMsg 6/*----------------------------------------------------------------------------- * Bell - ring a bell on the client if it has one. */typedef struct {    CARD8 type;			/* always rfbBell */} rfbBellMsg;#define sz_rfbBellMsg 1/*----------------------------------------------------------------------------- * ServerCutText - the server has new text in its cut buffer. */typedef struct {    CARD8 type;			/* always rfbServerCutText */    CARD8 pad1;    CARD16 pad2;    CARD32 length;    /* followed by char text[length] */} rfbServerCutTextMsg;#define sz_rfbServerCutTextMsg 8/*----------------------------------------------------------------------------- * Union of all server->client messages. */typedef union {    CARD8 type;    rfbFramebufferUpdateMsg fu;    rfbSetColourMapEntriesMsg scme;    rfbBellMsg b;    rfbServerCutTextMsg sct;} rfbServerToClientMsg;/***************************************************************************** * * Message definitions (client -> server) * *****************************************************************************//*----------------------------------------------------------------------------- * SetPixelFormat - tell the RFB server the format in which the client wants * pixels sent. */typedef struct {    CARD8 type;			/* always rfbSetPixelFormat */    CARD8 pad1;    CARD16 pad2;    rfbPixelFormat format;} rfbSetPixelFormatMsg;#define sz_rfbSetPixelFormatMsg (sz_rfbPixelFormat + 4)/*----------------------------------------------------------------------------- * FixColourMapEntries - when the pixel format uses a "colour map", fix * read-only colour map entries. * *    ***************** NOT CURRENTLY SUPPORTED ***************** */typedef struct {    CARD8 type;			/* always rfbFixColourMapEntries */    CARD8 pad;    CARD16 firstColour;    CARD16 nColours;    /* Followed by nColours * 3 * CARD16       r1, g1, b1, r2, g2, b2, r3, g3, b3, ..., rn, bn, gn */} rfbFixColourMapEntriesMsg;#define sz_rfbFixColourMapEntriesMsg 6/*----------------------------------------------------------------------------- * SetEncodings - tell the RFB server which encoding types we accept.  Put them * in order of preference, if we have any.  We may always receive raw * encoding, even if we don't specify it here. */typedef struct {    CARD8 type;			/* always rfbSetEncodings */    CARD8 pad;    CARD16 nEncodings;    /* followed by nEncodings * CARD32 encoding types */} rfbSetEncodingsMsg;#define sz_rfbSetEncodingsMsg 4/*----------------------------------------------------------------------------- * FramebufferUpdateRequest - request for a framebuffer update.  If incremental * is true then the client just wants the changes since the last update.  If * false then it wants the whole of the specified rectangle. */typedef struct {    CARD8 type;			/* always rfbFramebufferUpdateRequest */    CARD8 incremental;    CARD16 x;    CARD16 y;    CARD16 w;    CARD16 h;} rfbFramebufferUpdateRequestMsg;#define sz_rfbFramebufferUpdateRequestMsg 10/*----------------------------------------------------------------------------- * KeyEvent - key press or release * * Keys are specified using the "keysym" values defined by the X Window System. * For most ordinary keys, the keysym is the same as the corresponding ASCII * value.  Other common keys are: * * BackSpace		0xff08 * Tab			0xff09 * Return or Enter	0xff0d * Escape		0xff1b * Insert		0xff63 * Delete		0xffff * Home			0xff50 * End			0xff57 * Page Up		0xff55 * Page Down		0xff56 * Left			0xff51 * Up			0xff52 * Right		0xff53 * Down			0xff54 * F1			0xffbe * F2			0xffbf * ...			... * F12			0xffc9 * Shift		0xffe1 * Control		0xffe3 * Meta			0xffe7 * Alt			0xffe9 */typedef struct {    CARD8 type;			/* always rfbKeyEvent */    CARD8 down;			/* true if down (press), false if up */    CARD16 pad;    CARD32 key;			/* key is specified as an X keysym */} rfbKeyEventMsg;#define sz_rfbKeyEventMsg 8/*----------------------------------------------------------------------------- * PointerEvent - mouse/pen move and/or button press. */typedef struct {    CARD8 type;			/* always rfbPointerEvent */    CARD8 buttonMask;		/* bits 0-7 are buttons 1-8, 0=up, 1=down */    CARD16 x;    CARD16 y;} rfbPointerEventMsg;#define rfbButton1Mask 1#define rfbButton2Mask 2#define rfbButton3Mask 4#define sz_rfbPointerEventMsg 6/*----------------------------------------------------------------------------- * ClientCutText - the client has new text in its cut buffer. */typedef struct {    CARD8 type;			/* always rfbClientCutText */    CARD8 pad1;    CARD16 pad2;    CARD32 length;    /* followed by char text[length] */} rfbClientCutTextMsg;#define sz_rfbClientCutTextMsg 8/*----------------------------------------------------------------------------- * Union of all client->server messages. */typedef union {    CARD8 type;    rfbSetPixelFormatMsg spf;    rfbFixColourMapEntriesMsg fcme;    rfbSetEncodingsMsg se;    rfbFramebufferUpdateRequestMsg fur;    rfbKeyEventMsg ke;    rfbPointerEventMsg pe;    rfbClientCutTextMsg cct;} rfbClientToServerMsg;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -